bpo-15999: Clean up of handling boolean arguments. by serhiy-storchaka · Pull Request #15610 · python/cpython (original) (raw)
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- Use the 'p' format unit instead of manually called PyObject_IsTrue().
- Pass boolean value instead 0/1 integers to functions that needs boolean.
- Convert some arguments to boolean only once.
https://bugs.python.org/issue15999
- Use the 'p' format unit instead of manually called PyObject_IsTrue().
- Pass boolean value instead 0/1 integers to functions that needs boolean.
- Convert some arguments to boolean only once.
@@ -130,7 +130,7 @@ def __init__(self): |
---|
self.flags = PyCF_DONT_IMPLY_DEDENT |
def __call__(self, source, filename, symbol): |
codeob = compile(source, filename, symbol, self.flags, 1) |
codeob = compile(source, filename, symbol, self.flags, True) |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that's OK.
https://docs.python.org/3.9/library/functions.html#compile
The argument optimize specifies the optimization level of the compiler; the default value of -1 selects the optimization level of the interpreter as given by -O options. Explicit levels are 0 (no optimization; debug is true), 1 (asserts are removed, debug is false) or 2 (docstrings are removed too).
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is dont_inherit
, not optimize
.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, sorry.
lisroach pushed a commit to lisroach/cpython that referenced this pull request
- Use the 'p' format unit instead of manually called PyObject_IsTrue().
- Pass boolean value instead 0/1 integers to functions that needs boolean.
- Convert some arguments to boolean only once.
DinoV pushed a commit to DinoV/cpython that referenced this pull request
- Use the 'p' format unit instead of manually called PyObject_IsTrue().
- Pass boolean value instead 0/1 integers to functions that needs boolean.
- Convert some arguments to boolean only once.
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request
- Use the 'p' format unit instead of manually called PyObject_IsTrue().
- Pass boolean value instead 0/1 integers to functions that needs boolean.
- Convert some arguments to boolean only once.
Reviewers
sir-sigurd sir-sigurd left review comments
rhettinger Awaiting requested review from rhettinger
1st1 Awaiting requested review from 1st1
abalkin Awaiting requested review from abalkin
asvetlov Awaiting requested review from asvetlov
pganssle Awaiting requested review from pganssle
tiran Awaiting requested review from tiran