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

Use inspect.getsourcelines to get code #1234

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

judahrand
Copy link

This function was not used previously due to a bug in how it cached source
code. This bug was fixed in Python 3.5 which is now EOL. This also allows
us to detect the actual line in source code of a lambda reducing possible
collisions.

See https://bugs.python.org/issue1218234

This function was not used previously due to a bug in how it cached source
code. This bug was fixed in Python 3.5 which is now EOL. This also allows
us to detect the actual line in source code of a lambda reducing possible
collisions.

See https://bugs.python.org/issue1218234
Copy link
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait for #1253 to be merged and then I will push a merge commit to this PR to re-run the CI.

Copy link
Contributor

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked at the details on what those 2 tests do but they fail on this PR while they pass on master:


=================================== FAILURES ===================================
_________________________ test_special_source_encoding _________________________

    def test_special_source_encoding():
        from joblib.test.test_func_inspect_special_encoding import big5_f
        func_code, source_file, first_line = get_func_code(big5_f)
>       assert first_line == 5
E       assert -1 == 5
E         +-1
E         -5

big5_f     = <function big5_f at 0x0000000006323600>
first_line = -1
func_code  = '-8379453629057454882'
source_file = '/home/vsts/work/1/s/joblib/test/test_func_inspect_special_encoding.py'

joblib/test/test_func_inspect.py:277: AssertionError
__________________________ test_func_code_consistency __________________________

    def test_func_code_consistency():
        from joblib.parallel import Parallel, delayed
        codes = Parallel(n_jobs=2)(delayed(_get_code)() for _ in range(5))
>       assert len(set(codes)) == 1
E       assert 2 == 1
E         +2
E         -1

Parallel   = <class 'joblib.parallel.Parallel'>
codes      = ['9209186506343720391', '3446341992231549869', '3446341992231549869', '3446341992231549869', '3446341992231549869']
delayed    = <function delayed at 0x00007f50a25e1740>

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.

None yet

2 participants