* bpo-34085: Improve wording on classmethod/staticmethod
* Address comments from Éric
* Address comments from Éric
(cherry picked from commit 548cb6060a)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
(cherry picked from commit 5e333784f0)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Check for sys.abiflags before using since not all platforms have it defined.
(cherry picked from commit a7987e7193)
Co-authored-by: AraHaan <15173749+AraHaan@users.noreply.github.com>
* Add tests for grep findfiles.
* Move findfiles to module function.
* Change findfiles to use os.walk.
Based on a patch by Al Sweigart.
(cherry picked from commit d60f658fc0)
Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
Clarify capturing or suppressing stdout and stderr on the old call APIs.
Do not state that they are equivalent to run() calls when they are not implemented using run as that was misleading. Unlike run they cannot handle stdout or stderr being set to PIPE without a risk of deadlock.
(cherry picked from commit 7a2e84c348)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Clarify that the naming of protocol handler methods shouldn't be literally called "protocol" but should be named after the actual protocol.
https://bugs.python.org/issue35155
(cherry picked from commit dd7c4ceed9)
Co-authored-by: Denton Liu <liu.denton+github@gmail.com>
bpo-36256: Fix bug in parsermodule when parsing if statements
In the parser module, when validating nodes before starting the parsing with to create a ST in "parser_newstobject" there is a problem that appears when two arcs in the same DFA state has transitions with labels with the same type. For example, the DFA for if_stmt has a state with
two labels with the same type: "elif" and "else" (type NAME). The algorithm tries one by one the arcs until the label that starts the arc transition has a label with the same type of the current child label we are trying to accept. In this case, the arc for "elif" comes before the arc for "else"and passes this test (because the current child label is "else" and has the same type as "elif"). This lead to expecting a namedexpr_test (305) instead of a colon (11). The solution is to compare also the string representation (in case there is one) of the labels to see if the transition that we have is the correct one.
(cherry picked from commit 9a0000d15d)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Replace strncpy() with memcpy() in call_readline() to fix the
following warning, the NUL byte is written manually just after:
Modules/readline.c: In function ‘call_readline’:
Modules/readline.c:1303:9: warning: ‘strncpy’ output truncated before
terminating nul copying as many bytes from a string as its length
[-Wstringop-truncation]
strncpy(p, q, n);
^~~~~~~~~~~~~~~~
Modules/readline.c:1279:9: note: length computed here
n = strlen(p);
^~~~~~~~~
(cherry picked from commit 1600f60414)
The test test_customize_compiler() now mocks all sysconfig variables
and all environment variables used by customize_compiler().
(cherry picked from commit 72c7b372cf)
* Replace external recipe link with a link to the dataclasses module.
* Highlight the class definition syntax for typing.NamedTuple
and add an example for clarity.
(cherry picked from commit 9c68543f02)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
Be explicit that timedelta division converts an overall duration to the interval
units given by the denominator.
(cherry picked from commit f40b4a0b62)
Co-authored-by: Yasser A <yalshalaan@gmail.com>
Fix CFLAGS in customize_compiler() of distutils.sysconfig: when the
CFLAGS environment variable is defined, don't override CFLAGS variable with
the OPT variable anymore.
Initial patch written by David Malcolm.
Co-Authored-By: David Malcolm <dmalcolm@redhat.com>
(cherry picked from commit 86082c22d2)
Fix an unlikely memory leak on conversion from string to float in the
function _Py_dg_strtod() used by float(str), complex(str),
pickle.load(), marshal.load(), etc.
Fix an unlikely memory leak in _Py_dg_strtod() on "undfl:" label:
rewrite memory management in this function to always release all
memory before exiting the function. Initialize variables to NULL, and
set them to NULL after calling Bfree() at the "cont:" label.
Note: Bfree(NULL) is well defined: it does nothing.
(cherry picked from commit 9776b0636a)