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

Support 313 #287

Merged
merged 12 commits into from
Sep 24, 2024
Merged

Support 313 #287

merged 12 commits into from
Sep 24, 2024

Conversation

Erotemic
Copy link
Member

Working on updating CI and supporting 3.13

@Erotemic Erotemic force-pushed the support-313 branch 2 times, most recently from 1a0710b to 4ad3f95 Compare September 15, 2024 16:57
@Erotemic
Copy link
Member Author

Ideas on what could be causing the failure would be helpful. I put a few hours into it this weekend, but I might need a bit of help if people want the 3.13 wheels published soon.

@Erotemic
Copy link
Member Author

Erotemic commented Sep 24, 2024

Errors on Ubuntu 3.13 seem to revolve around OverflowError: int too big to convert, although the function that is running should not be having any issues with that.

On Windows 3.13, the autoprofile seems to be very agressive and profile far more than is requested by the test:

2024-09-15T23:17:56.4538624Z ================================== FAILURES ===================================
2024-09-15T23:17:56.4539146Z __________________ test_autoprofile_script_with_prof_imports __________________
2024-09-15T23:17:56.4539518Z 
2024-09-15T23:17:56.4539670Z     def test_autoprofile_script_with_prof_imports():
2024-09-15T23:17:56.4540027Z         """
2024-09-15T23:17:56.4540368Z         Test the imports of the specified modules are profiled as well.
2024-09-15T23:17:56.4540776Z         """
2024-09-15T23:17:56.4541024Z         temp_dpath = ub.Path(tempfile.mkdtemp())
2024-09-15T23:17:56.4541420Z         script_fpath = _write_demo_module(temp_dpath)
2024-09-15T23:17:56.4542075Z     
2024-09-15T23:17:56.4542257Z         # import sys
2024-09-15T23:17:56.4542529Z         # if sys.version_info[0:2] >= (3, 11):
2024-09-15T23:17:56.4542850Z         #     import pytest
2024-09-15T23:17:56.4543405Z         #     pytest.skip('Failing due to the noop bug')
2024-09-15T23:17:56.4543739Z     
2024-09-15T23:17:56.4544343Z         args = [sys.executable, '-m', 'kernprof', '--prof-imports', '-p', 'script.py', '-l', os.fspath(script_fpath)]
2024-09-15T23:17:56.4545041Z         proc = ub.cmd(args, cwd=temp_dpath, verbose=0)
2024-09-15T23:17:56.4545512Z         print('Kernprof Stdout:')
2024-09-15T23:17:56.4545805Z         print(proc.stdout)
2024-09-15T23:17:56.4546116Z         print('Kernprof Stderr:')
2024-09-15T23:17:56.4546405Z         print(proc.stderr)
2024-09-15T23:17:56.4557950Z         print('About to check kernprof return code')
2024-09-15T23:17:56.4558348Z         proc.check_returncode()
2024-09-15T23:17:56.4558731Z     
2024-09-15T23:17:56.4559737Z         args = [sys.executable, '-m', 'line_profiler', os.fspath(script_fpath) + '.lprof']
2024-09-15T23:17:56.4560718Z         proc = ub.cmd(args, cwd=temp_dpath, verbose=0)
2024-09-15T23:17:56.4561370Z         raw_output = proc.stdout
2024-09-15T23:17:56.4562030Z         print('Line_profile Stdout:')
2024-09-15T23:17:56.4562568Z         print(raw_output)
2024-09-15T23:17:56.4563204Z         print('About to check line_profiler return code')
2024-09-15T23:17:56.4563876Z >       proc.check_returncode()
2024-09-15T23:17:56.4564446Z 
2024-09-15T23:17:56.4564624Z test_autoprofile.py:330: 
2024-09-15T23:17:56.4565235Z _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
2024-09-15T23:17:56.4565827Z 
2024-09-15T23:17:56.4567803Z self = {'out': 'Timer unit: 1e-06 s\n\nTotal time: 0.0003079 s\nFile: C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp4neyxuef\...test\\Scripts\\python.exe' -m line_profiler 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp4neyxuef\\script.py.lprof'"}
2024-09-15T23:17:56.4569686Z 
2024-09-15T23:17:56.4569879Z     def check_returncode(self):
2024-09-15T23:17:56.4570701Z         """Raise CalledProcessError if the exit code is non-zero."""
2024-09-15T23:17:56.4571393Z         import subprocess
2024-09-15T23:17:56.4571848Z         if self.returncode:
2024-09-15T23:17:56.4572391Z >           raise subprocess.CalledProcessError(
2024-09-15T23:17:56.4573136Z                 self.returncode, self.args, self.stdout, self.stderr)
2024-09-15T23:17:56.4576078Z E           subprocess.CalledProcessError: Command '['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-44n45uqp\\cp313-win_amd64\\venv-test\\Scripts\\python.exe', '-m', 'line_profiler', 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp4neyxuef\\script.py.lprof']' returned non-zero exit status 1.
2024-09-15T23:17:56.4577984Z 
2024-09-15T23:17:56.4578997Z C:\Users\runneradmin\AppData\Local\Temp\cibw-run-44n45uqp\cp313-win_amd64\venv-test\Lib\site-packages\ubelt\util_cmd.py:137: CalledProcessError
2024-09-15T23:17:56.4580492Z ---------------------------- Captured stdout call -----------------------------
2024-09-15T23:17:56.4581096Z Kernprof Stdout:
2024-09-15T23:17:56.4581396Z 7.9162303664921465
2024-09-15T23:17:56.4581753Z Wrote profile results to script.py.lprof
2024-09-15T23:17:56.4582226Z Inspect results with:
2024-09-15T23:17:56.4583492Z C:\Users\runneradmin\AppData\Local\Temp\cibw-run-44n45uqp\cp313-win_amd64\venv-test\Scripts\python.exe -m line_profiler -rmt "script.py.lprof"
2024-09-15T23:17:56.4584610Z 
2024-09-15T23:17:56.4584736Z Kernprof Stderr:
2024-09-15T23:17:56.4587684Z C:\Users\runneradmin\AppData\Local\Temp\cibw-run-44n45uqp\cp313-win_amd64\venv-test\Lib\site-packages\coverage\pytracer.py:320: CoverageWarning: Trace function changed, data is likely wrong: <line_profiler.line_profiler.LineProfiler object at 0x0000022305408BB0> != <bound method PyTracer._trace of <PyTracer at 0x22305136490: 355 data points in 10 files>> (trace-changed)
2024-09-15T23:17:56.4590312Z   self.warn(

EDIT: I think the problem with windows is actually a unicode issue with ():

UnicodeEncodeError: 'charmap' codec can't encode character '\u2248' in position 82: character maps to <undefined

This seems to be due to CPython adding the character into the stdlib statistics module: https://github.com/search?q=repo%3Apython%2Fcpython%20%E2%89%88&type=code

@Erotemic
Copy link
Member Author

I've been able to work around the windows error by avoiding printing lines that cause a UnicodeEncodingError. It would be nice to have a more robust fix, but this will work well enough for now, and it wont be a problem for people who have utf-enabled terminals. I think its just a CI thing.

The error on Ubuntu with the overflow is harder for me to understand. It feels like there is something deeply wrong in what arguments are being passed into the functions. Fibonacci of 10 should not cause an interger overflow, but in the test for 3.13 on Ubuntu it is. I think there is something wrong with a signature, and the profile is causing wrong arguments to be passed around. I cannot reproduce this behavior on my local machine. It looks like it is a cp313-musllinux_i686 wheel issue? I'm going to try to disable it.

@Erotemic Erotemic merged commit bf39251 into main Sep 24, 2024
68 checks passed
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