-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-2506: Add -X noopt command line option #13600
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ byte-code cache files in the directory containing the source code. | |
Exception raised when an error occurs while attempting to compile the file. | ||
|
||
|
||
.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP) | ||
.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1, invalidation_mode=PycInvalidationMode.TIMESTAMP, *, noopt=False) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know but I failed to find better names. |
||
|
||
Compile a source file to byte-code and write out the byte-code cache file. | ||
The source code is loaded from the file named *file*. The byte-code is | ||
|
@@ -60,6 +60,9 @@ byte-code cache files in the directory containing the source code. | |
:func:`compile` function. The default of ``-1`` selects the optimization | ||
level of the current interpreter. | ||
|
||
If *noopt* is true, disable compiler optimizations and ignore *optimize* | ||
argument. If it is ``None``, use ``sys.flags.noopt`` value. | ||
|
||
*invalidation_mode* should be a member of the :class:`PycInvalidationMode` | ||
enum and controls how the generated bytecode cache is invalidated at | ||
runtime. The default is :attr:`PycInvalidationMode.CHECKED_HASH` if | ||
|
@@ -92,6 +95,9 @@ byte-code cache files in the directory containing the source code. | |
.. versionchanged:: 3.8 | ||
The *quiet* parameter was added. | ||
|
||
.. versionchanged:: 3.9 | ||
The *noopt* parameter was added. | ||
|
||
|
||
.. class:: PycInvalidationMode | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -418,6 +418,7 @@ always available. | |
:const:`inspect` :option:`-i` | ||
:const:`interactive` :option:`-i` | ||
:const:`isolated` :option:`-I` | ||
:const:`noopt` :option:`-X noopt <-X>` | ||
:const:`optimize` :option:`-O` or :option:`-OO` | ||
:const:`dont_write_bytecode` :option:`-B` | ||
:const:`no_user_site` :option:`-s` | ||
|
@@ -447,6 +448,9 @@ always available. | |
Added ``dev_mode`` attribute for the new :option:`-X` ``dev`` flag | ||
and ``utf8_mode`` attribute for the new :option:`-X` ``utf8`` flag. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you want to change these two (and line 424-425) for consistent style :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I chose to not change these on purpose, it would be an unrelated change. Someone can work on a PR to update these once this PR is merged ;-) |
||
|
||
.. versionchanged:: 3.9 | ||
Added ``noopt`` attribute for the new :option:`-X noopt <-X>` option. | ||
|
||
|
||
.. data:: float_info | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,14 @@ PyAPI_FUNC(PyCodeObject *) PyAST_CompileObject( | |
PyCompilerFlags *flags, | ||
int optimize, | ||
PyArena *arena); | ||
PyAPI_FUNC(PyCodeObject *) _PyAST_Compile( | ||
struct _mod *mod, | ||
PyObject *filename, | ||
PyCompilerFlags *flags, | ||
int optimization_level, | ||
PyArena *arena, | ||
int noopt); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not it be controlled by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optimization_level=0 still means having optimizations enabled. I cannot change to keep the backward compatibility. Do you think that it would be better to add a new |
||
|
||
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST( | ||
struct _mod * mod, | ||
const char *filename /* decoded from the filesystem encoding */ | ||
|
Uh oh!
There was an error while loading. Please reload this page.