Commit Graph

413 Commits

Author SHA1 Message Date
Miss Islington (bot) dffe90ee0e
bpo-36459: Fix a possible double PyMem_FREE() due to tokenizer.c's tok_nextc() (12601)
Remove the PyMem_FREE() call added in cb90c89.  The buffer will be
freed when PyTokenizer_Free() is called on the tokenizer state.
(cherry picked from commit cda139d1de)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-03-28 07:44:21 -07:00
Victor Stinner 469b0a50d9
bpo-36367: Free buffer if realloc fails in tokenize.c (GH-12442) (GH-12470)
(cherry picked from commit cb90c89de1)
2019-03-20 13:03:41 +01:00
stratakis d9c6564f90 [2.7] bpo-18368: Fix memory leaks in PyOS_StdioReadline() when realloc() fails (GH-12334)
(cherry picked from commit 9ae513caa7)
2019-03-19 11:43:20 +01:00
tzickel f64c813de8 bpo-25083: Python can sometimes create incorrect .pyc files (GH-8449)
Python 2 never checked for I/O error when reading .py files and
thus could mistake an I/O error for EOF and create incorrect .pyc
files.
This adds an check for this and aborts on an error.
2018-09-10 11:46:14 -07:00
Zackery Spytz eb9a1c01d0 [2.7] bpo-34400: Fix more undefined behavior in parsetok.c (GH-8833). (GH-8849)
(cherry picked from commit 3e26e42c90)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-08-22 08:54:17 +03:00
Miss Islington (bot) 00aebabc71
closes bpo-34400: Fix undefined behavior in parsetok(). (GH-4439)
Avoid undefined pointer arithmetic with NULL.
(cherry picked from commit 7c4ab2afb1)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2018-08-15 02:59:11 -04:00
Serhiy Storchaka 48c8bf21f9
[2.7] bpo-34234: Use _PyAnyInt_Check() and _PyAnyInt_CheckExact(). (GH-8479) 2018-07-31 09:09:36 +03:00
Zachary Ware 16137fe22f bpo-27780: Make pgen.c C89 compliant (GH-7915) 2018-06-25 20:40:15 -07:00
Benjamin Peterson 9ee9efa9fd
make pgen.c C89 compliant again (GH-7870) 2018-06-22 21:51:44 -07:00
Benjamin Peterson 482fac7499
[2.7] properly free memory in pgen. (GH-7869) (closes bpo-27780
(cherry picked from commit 9ac11a752a)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2018-06-22 21:04:21 -07:00
Serhiy Storchaka d5e7556e52
bpo-33645: Fix an "unknown parsing error" in the parser. (GH-7119)
It is reproduced when parse the "<>" operator and run
Python with both options -3 and -We.
2018-05-31 07:35:39 +03:00
Yuan Chao Chou 5fbb8e367d Fix a shadow-compatible-local warning (#2182)
Change the shadowing naming, 'value' (Python-ast.c:3814), to 'val'
to prevent the variables from being misused.
2017-08-04 10:54:27 -07:00
Benjamin Peterson d9a75744ee reinit the TLS before anything else (#130)
PyEval_ReInitThread can run arbitrary Python code, which really ought to have
the TLS initialized.
2017-02-20 23:43:15 -08:00
Serhiy Storchaka 6a35bf6ca0 Silenced compiler warnings. 2016-10-08 09:58:08 +03:00
Serhiy Storchaka 08995a3390 Issue #24098: Fixed possible crash when AST is changed in process of
compiling it.
2016-10-07 21:51:09 +03:00
Martin Panter 0d0aa32daa Revert unintended commit to asdl_c.py 2016-09-24 05:38:14 +00:00
Martin Panter 5d4dd9acb6 Fix incomplete format error in asdl.py 2016-09-24 05:35:15 +00:00
Benjamin Peterson 274a76323c properly handle the single null-byte file (closes #24022) 2016-09-18 23:41:11 -07:00
Martin Panter 3d36f0f712 Spelling and grammar fixes in code comments and documentation 2016-07-28 02:37:04 +00:00
Martin Panter 646b528467 Issue #22463: Backport compiler warning fixes and workarounds
* Set but unused variable in Parser/pgen.c in non-debug builds. Patch by
  Christian Heimes.
* Unused static function in Modules/readline.c. Patch by Georg Brandl.
* main_window unused in Modules/tkappinit.c. Patch by Gregory P. Smith.
* Dead assignment in Modules/_ctypes/cfield.c. Extracted from patch by Brett
  Cannon.
* Expression result unused in PyObject_INIT macro expansions. Based on
  patches by Christian Heimes.
* Load expat_config.h and therefore pyconfig.h before C stdlib headers are
  loaded. This silences pre-processor warnings including '_POSIX_C_SOURCE
  redefined'. Extracted from patch by Christian Heimes.
2016-06-21 23:58:05 +00:00
Serhiy Storchaka 5d7d26c403 Issue #25388: Fixed tokenizer hang when processing undecodable source code
with a null byte.
2015-11-14 15:14:29 +02:00
Benjamin Peterson 223546d55c add missing NULL checks to get_coding_spec (closes #24854) 2015-08-13 21:52:56 -07:00
Serhiy Storchaka 3eb554fc82 Issue #22221: Backported fixes from Python 3 (issue #18960).
* Now the source encoding declaration on the second line isn't effective if
  the first line contains anything except a comment.  This affects compile(),
  eval() and exec() too.

* IDLE now ignores the source encoding declaration on the second line if the
  first line contains anything except a comment.

* 2to3 and the findnocoding.py script now ignore the source encoding
  declaration on the second line if the first line contains anything except
  a comment.
2014-09-05 10:22:05 +03:00
Ned Deily 24b8209a4e Issue #21789: fix broken link (reported by Jan Varho) 2014-06-17 12:24:53 -07:00
Benjamin Peterson 93e51aac54 allow the keyword else immediately after (no space) an integer (closes #21642) 2014-06-07 12:36:39 -07:00
Benjamin Peterson 22d9ee7e17 complain if the codec doesn't return unicode 2013-12-28 10:33:58 -06:00
Ezio Melotti 6d0f0f299b #18803: fix more typos. Patch by Févry Thibault. 2013-08-26 01:31:30 +03:00
Serhiy Storchaka 729ad5cf56 Issue #18038: SyntaxError raised during compilation sources with illegal
encoding now always contains an encoding name.
2013-06-09 16:54:56 +03:00
Trent Nelson 05c197c75e Make PyAST_obj2mod C89 compliant. 2012-12-13 07:13:18 +00:00
Ezio Melotti c820de5e60 #15923: fix a mistake in asdl_c.py that resulted in a TypeError after 2801bf875a24 (see #15801). 2012-09-30 22:41:37 +03:00
Georg Brandl 02144cca2f Remove unused variables in parsetok(). 2012-08-11 11:16:18 +02:00
Jesus Cea 3e3192d8f7 Closes #15512: Correct __sizeof__ support for parser 2012-08-03 14:25:53 +02:00
Jesus Cea d0f5f4827d Issue #1677: Unused variable warning in Non-Windows 2012-07-03 13:07:58 +02:00
Jesus Cea 99ad1f1354 Backed out changeset 7ccc2cea6969 2012-07-03 13:06:45 +02:00
Jesus Cea 263afe2fed Issue #1667: Unused variable warning in Non-Windows 2012-07-03 13:04:55 +02:00
Tim Golden 4702336a0d Issue #1677: Handle better a race condition between the interactive interpreter and
the Ctrl-C signal handler on Windows
2012-06-29 18:20:44 +01:00
Benjamin Peterson 5eed3062f5 allow None identifiers 2011-07-22 17:20:58 -05:00
Benjamin Peterson 77820242dd verify the types of AST strings and identifiers (closes #12609 and #12610) 2011-07-22 10:39:50 -05:00
Benjamin Peterson 59c69512be hardcode the old svn __version__ 2011-07-22 10:39:12 -05:00
Victor Stinner 08563d904d Issue #12016: my_fgets() now always clears errors before calling fgets(). Fix
the following case: sys.stdin.read() stopped with CTRL+d (end of file),
raw_input() interrupted by CTRL+c.
2011-05-30 23:44:13 +02:00
Victor Stinner 2c585f607e (Merge 3.1) Issue #1195: Fix input() if it is interrupted by CTRL+d and then
CTRL+c, clear the end-of-file indicator after CTRL+d.
2011-05-10 00:22:59 +02:00
Victor Stinner 5de51ac4c0 (Merge 3.1) Issue #11650: PyOS_StdioReadline() retries fgets() if it was
interrupted (EINTR), for example if the program is stopped with CTRL+z on Mac
OS X. Patch written by Charles-Francois Natali.
2011-04-09 16:09:08 +02:00
Stefan Krah 3db4161011 Issue #9020: The Py_IS* macros from pyctype.h should generally only be
used with signed/unsigned char arguments. For integer arguments, EOF
has to be handled separately.
2010-06-24 09:33:05 +00:00
Benjamin Peterson c009735b50 spacing nit; this isn't C 2010-06-22 19:45:51 +00:00
Benjamin Peterson 1056ca264f fix code formatting 2010-06-09 19:45:04 +00:00
Senthil Kumaran cccfce1959 Doc Fix. Correct link to Zephyr ASDL Abstract page. 2010-05-18 13:40:23 +00:00
Victor Stinner 3bea1ede7d Use 4-spaces for indentation (instead of tabs) in pgen outputs
Regenerate (reindent) Python/graminit.c
2010-05-15 22:55:28 +00:00
Antoine Pitrou c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Benjamin Peterson 88623d76b4 use our own locale independent ctype macros
requires building pyctype.o into pgen
2010-04-03 23:03:35 +00:00
Benjamin Peterson 4ceeeb09d8 ensure that the locale does not affect the tokenization of identifiers 2010-04-03 22:48:51 +00:00