Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column Fixes #221

Merged
merged 8 commits into from
Aug 3, 2023
Merged

Column Fixes #221

merged 8 commits into from
Aug 3, 2023

Conversation

Erotemic
Copy link
Member

@Erotemic Erotemic commented Aug 3, 2023

Use scientific notation when columns get too long. This should prevent columns from becoming misaligned in the output stats.

Adds several new tests for this and other potential issues.

@Erotemic
Copy link
Member Author

Erotemic commented Aug 3, 2023

@Theelx in this PR, I've added some tests that run into the issue of having two functions with the exact same code.

The file: https://github.com/pyutils/line_profiler/blob/8d7a2f5982314d3ba3562d3b30c6f0cfb8107595/tests/complex_example.py

is a standalone script you should be able to run on your end to reproduce the issue. Running the script results in:

Traceback (most recent call last):
  File "/home/joncrall/code/line_profiler/tests/complex_example.py", line 51, in <module>
    @profile
     ^^^^^^^
  File "/home/joncrall/code/line_profiler/line_profiler/line_profiler.py", line 56, in __call__
    self.add_function(func)
  File "line_profiler/_line_profiler.pyx", line 199, in line_profiler._line_profiler.LineProfiler.add_function
  File "line_profiler/_line_profiler.pyx", line 224, in line_profiler._line_profiler.LineProfiler.add_function
  File "line_profiler/_line_profiler.pyx", line 127, in line_profiler._line_profiler._code_replace
ValueError: code: co_code is malformed

on Python 3.11. Note on Python 3.6 it works as-is.

@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #221 (12ed532) into main (bdd69ee) will decrease coverage by 8.57%.
The diff coverage is 83.33%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #221      +/-   ##
==========================================
- Coverage   51.61%   43.05%   -8.57%     
==========================================
  Files           4        4              
  Lines         279      295      +16     
  Branches       40       54      +14     
==========================================
- Hits          144      127      -17     
- Misses        121      155      +34     
+ Partials       14       13       -1     
Files Changed Coverage Δ
line_profiler/line_profiler.py 55.00% <83.33%> (+1.56%) ⬆️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bdd69ee...12ed532. Read the comment docs.

@Erotemic Erotemic merged commit 7706d56 into main Aug 3, 2023
12 checks passed
@Erotemic Erotemic mentioned this pull request Aug 6, 2023
@Erotemic Erotemic deleted the fix_long_columns branch August 12, 2023 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant