Skip to content

gh-94512: Fix forced arg format in AC-processed resource #94515

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

Merged
merged 6 commits into from
Jul 29, 2022

Conversation

arhadthedev
Copy link
Member

@arhadthedev arhadthedev commented Jul 2, 2022

Please note that this commit also removes an old way to express optional parameters (it prevented the new style generation):

 /*[clinic input]
 resource.prlimit

     pid: pid_t
     resource: int
-    [
-    limits: object
-    ]
+    limits: object = None
     /

[clinic start generated code]*/

I hope it breaks nothing.

@arhadthedev
Copy link
Member Author

arhadthedev commented Jul 2, 2022

I have no idea why resource module doesn't build on Ubuntu (a CI log contains neither compiler error nor any mention of the module name).

The failure manifests itself as a later inability to load a non-existent module in python -m unittest -v test.test_resource.ResourceTest.test_prlimit.

Running Release|x64 interpreter...
Traceback (most recent call last):
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\test\support\import_helper.py", line 78, in import_module
    return importlib.import_module(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1142, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'resource'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\__main__.py", line 18, in <module>
    main(module=None)
    ^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\main.py", line 101, in __init__
    self.parseArgs(argv)
    ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\main.py", line 150, in parseArgs
    self.createTests()
    ^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\main.py", line 161, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\loader.py", line 198, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\loader.py", line 198, in <listcomp>
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\unittest\loader.py", line 132, in loadTestsFromName
    module = __import__(module_name)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\test\test_resource.py", line 9, in <module>
    resource = import_helper.import_module('resource')
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\oleg\Documents\dev\notmine\cpython\Lib\test\support\import_helper.py", line 82, in import_module
    raise unittest.SkipTest(str(msg))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
unittest.case.SkipTest: No module named 'resource'

@arhadthedev
Copy link
Member Author

The bug is fixed.

@zooba zooba merged commit a739ee4 into python:main Jul 29, 2022
@arhadthedev arhadthedev deleted the clinic-resource-deformat branch July 29, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants