[issue46147] Support AddressSanitizer in Windows build

2021-12-21 Thread anthony shaw
New submission from anthony shaw : I'd like to compile my C-extensions with ASAN for testing in Windows, but they cannot be loaded as the host python.exe process needs to be compiled with ASAN. https://docs.microsoft.com/en-us/cpp/sanitizers/asan?view=msvc-170#ide-msbuild The Enabl

[issue46147] Support AddressSanitizer in Windows build

2021-12-21 Thread anthony shaw
anthony shaw added the comment: After some experimentation, this can be done if you enable ASAN in all projects except python3dll.vcxproj I think it would make sense (if this were supported) to have a flag in build.bat like there is for pgo `build.bat --asan

[issue46704] Parser API not checking for null-terminator

2022-02-09 Thread anthony shaw
New submission from anthony shaw : In tokenizer.c, the translate_newlines() function does a `strlen()` on the input string, if the string is not null-terminated, e.g. '\xbe' this leads to a heap-buffer-overflow. The overflow is not exploitable, but if there are further changes to

[issue46707] Parser hanging on stacked { tokens

2022-02-09 Thread anthony shaw
New submission from anthony shaw : Providing an (invalid) input to the parser causes an exponentially-slow DoS to the Python executable in 3.10. e.g. python3.10 -c "{:" takes ~2 seconds python3.10 -c ":" takes ~22 seconds

[issue46707] Parser hanging on stacked { tokens

2022-02-09 Thread anthony shaw
Change by anthony shaw : -- versions: +Python 3.10, Python 3.11 ___ Python tracker <https://bugs.python.org/issue46707> ___ ___ Python-bugs-list mailin

[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread anthony shaw
anthony shaw added the comment: Guido, regen.vcxproj targets 142 as the SDK version, which is most likely a mistake. The other projects are part of the main PCBuild.sln solution, which has a variable for the base SDK version. If you need to change it quickly, you can either open it in VS

[issue44692] Const unfolding in parser with negative numbers doesn't match float/int behaviour

2021-07-20 Thread anthony shaw
New submission from anthony shaw : Powers with negative bases do not observe the same rules that float_pow/long_pow do when it comes to returning negative results/ Example: > -2 ** 2 -4 >>> x = -2 >>> y = 2 >>> x ** y 4 >>> -2. ** 2. -4.0 >>&

[issue44692] Const folding in parser with negative numbers doesn't match float/int behaviour

2021-07-20 Thread anthony shaw
Change by anthony shaw : -- title: Const unfolding in parser with negative numbers doesn't match float/int behaviour -> Const folding in parser with negative numbers doesn't match float/int behaviour ___ Python tracker <https:/

[issue44692] Const folding in parser with negative numbers doesn't match float/int behaviour

2021-07-20 Thread anthony shaw
anthony shaw added the comment: Thanks! I didn't realise it applied the negative operator instead of loading the constant value. -- ___ Python tracker <https://bugs.python.org/is

[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread anthony shaw
New submission from anthony shaw : make tags will include - Modules/_ctypes/ where as make TAGS will not. Also, neither include the Python source files for the standard library, which both etags and ctags are capable of handling. PR to follow -- components: Build messages: 358917

[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread anthony shaw
anthony shaw added the comment: Also, make tags will reset the "tags" file, whereas, make TAGS will not. If you ran "make tags" then "make TAGS" you will have a corrupt etags file -- ___ Python tracker <h

[issue39144] Align ctags and etags targets and include Python stdlib

2019-12-27 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +17166 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17721 ___ Python tracker <https://bugs.python.org/issu

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw
New submission from anthony shaw : I've noticed that ./configure --help is inconsistent. - The way default values are shared - The way enumerated - The verbs used (e.g. enable, set) - Some --with-xyx and some --with(out-xyz) - Some start with capitals, others don't Also, many of

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw
anthony shaw added the comment: Current Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-universalsdk

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw
anthony shaw added the comment: Updated version based on principles: - Should not specify --with(out) in help string - Sentences should start with lowercase (as autoconf generates the builtin string with lower case) - --with-xyx=VALUE will be described as "overriding" - --with-x

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +17185 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17747 ___ Python tracker <https://bugs.python.org/issu

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw
Change by anthony shaw : -- nosy: +anthonypjshaw ___ Python tracker <https://bugs.python.org/issue39160> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39160] ./configure --help has inconsistencies in style

2019-12-29 Thread anthony shaw
Change by anthony shaw : -- nosy: +twouters ___ Python tracker <https://bugs.python.org/issue39160> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39162] setup.py not picking up tkinter headers

2019-12-30 Thread anthony shaw
Change by anthony shaw : -- nosy: +ned.deily ___ Python tracker <https://bugs.python.org/issue39162> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39162] setup.py not picking up tkinter headers

2019-12-30 Thread anthony shaw
New submission from anthony shaw : ./configure && make -j4 is returning: Failed to build these modules: _tkinter I'm running macOS 10.15.2, with the SDK installed using `xcode-select --install` (no funny business) /Libr

[issue39162] setup.py not picking up tkinter headers

2019-12-30 Thread anthony shaw
anthony shaw added the comment: I also can't see how this condition would ever match, since macosx_sdk_root() is not in the list being iterated upon, https://github.com/python/cpython/blob/master/setup.py#L1774 -- ___ Python tracker &

[issue39162] setup.py not picking up tkinter headers

2019-12-30 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +17189 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17753 ___ Python tracker <https://bugs.python.org/issu

[issue39162] setup.py not picking up tkinter headers

2019-12-30 Thread anthony shaw
anthony shaw added the comment: This comes down to a logic bug in detect_tkinter_darwin(), shown in https://github.com/python/cpython/pull/17753/files#r361956102 -- ___ Python tracker <https://bugs.python.org/issue39

[issue39185] Add quiet and detailed verbosity levels to build.bat

2020-01-01 Thread anthony shaw
New submission from anthony shaw : The build.bat script (windows build) has a flag for verbose, which sets the msbuild verbosity level to normal. The default level is minimal. The quiet and detailed levels would also be useful for development. -- components: Windows messages: 359178

[issue39185] Add quiet and detailed verbosity levels to build.bat

2020-01-01 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +17224 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17791 ___ Python tracker <https://bugs.python.org/issu

[issue39186] Windows installer instructions refer to mercurial

2020-01-01 Thread anthony shaw
New submission from anthony shaw : Very minor, but the instructions in Tools/msi/readme.txt tell the user to ensure hg.exe is in PATH, but the scripts use Git. -- components: Windows messages: 359179 nosy: anthonypjshaw, paul.moore, steve.dower, tim.golden, zach.ware priority: normal

[issue39186] Windows installer instructions refer to mercurial

2020-01-01 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +17225 stage: -> patch review pull_request: https://github.com/python/cpython/pull/17792 ___ Python tracker <https://bugs.python.org/issu

[issue34946] inspect.getcallargs is marked as deprecated in documentation, but doesn't issue a DeprecationWarning when used

2020-01-03 Thread anthony shaw
anthony shaw added the comment: Resolved by another bpo -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue39498] Signpost security considerations in library

2020-01-29 Thread anthony shaw
New submission from anthony shaw : Within the documentation, there are some really important security considerations for standard library modules. e.g. subprocess, ssl, pickle, xml. There is currently no "index" of these, so you have to go hunting for them. They're easter

[issue39498] Signpost security considerations in library

2020-01-29 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +17647 stage: -> patch review pull_request: https://github.com/python/cpython/pull/18272 ___ Python tracker <https://bugs.python.org/issu

[issue40432] Pegen regenerate project for Windows not working

2020-04-28 Thread anthony shaw
New submission from anthony shaw : The additional tasks in the MSBuild project for pegen regeneration are not functional: - Setting PYTHONPATH= inline cannot be done in Windows using that method - The task does not inherit environment variables that way - The path to the peg_generator module

[issue40432] Pegen regenerate project for Windows not working

2020-04-28 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +19108 stage: -> patch review pull_request: https://github.com/python/cpython/pull/19785 ___ Python tracker <https://bugs.python.org/issu

[issue40490] peg_generator module has unused imports

2020-05-03 Thread anthony shaw
New submission from anthony shaw : the tools/peg_generator package contains a number of unused imports -- components: Interpreter Core messages: 368005 nosy: anthonypjshaw, pablogsal priority: normal severity: normal stage: needs patch status: open title: peg_generator module has

[issue40490] peg_generator module has unused imports

2020-05-03 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +19202 stage: needs patch -> patch review pull_request: https://github.com/python/cpython/pull/19891 ___ Python tracker <https://bugs.python.org/issu

[issue34956] _tkinter built on macOS 10.14 does not link to Tcl and Tk in /Library/Frameworks

2020-05-18 Thread anthony shaw
Change by anthony shaw : -- nosy: +anthonypjshaw nosy_count: 4.0 -> 5.0 pull_requests: +19480 pull_request: https://github.com/python/cpython/pull/17753 ___ Python tracker <https://bugs.python.org/issu

[issue42521] Debug (-d) mode not working in 3.9

2020-12-01 Thread anthony shaw
New submission from anthony shaw : I noticed since the new parser implementation, the debug mode in the tokeniser is no longer working. This is the case for 3.9.0 and also 3.9.1rc1. Running python3.9 with a simple application like this: # Demo application def my_function(): proceed

[issue42521] Debug (-d) mode not working in 3.9

2020-12-01 Thread anthony shaw
anthony shaw added the comment: thanks, it would be great if this were documented in the --help section like the other options which require a debug build (-X showrefcount) -- ___ Python tracker <https://bugs.python.org/issue42

[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread anthony shaw
anthony shaw added the comment: which version of Python were you doing this on? The function in question is https://github.com/python/cpython/blob/master/Lib/xml/etree/ElementTree.py#L1233-L1278 -- nosy: +anthonypjshaw ___ Python tracker <ht

[issue43292] xml.ElementTree iterparse filehandle left open

2021-02-21 Thread anthony shaw
anthony shaw added the comment: Example script attached works perfectly on macOS > python3.9 test.py [('default', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties'), ('vt', 'http://schemas.openxmlformats.org/officeDocu

[issue41888] Duplicate Opcode value in master and 3.9rc2

2020-09-29 Thread anthony shaw
New submission from anthony shaw : I noticed that HAVE_ARGUMENT and STORE_NAME have the same value (90) in Include/opcode.h in both the source code and in the 2bd31b5f revision (3.9.0rc2). This must be creating some weird bugs. https://github.com/python/cpython/blob

[issue41888] Duplicate Opcode value in master and 3.9rc2

2020-09-29 Thread anthony shaw
anthony shaw added the comment: No, this is intentional. sorry. closing https://github.com/python/cpython/blob/34cd3e9f6a87f9c50edac893b0d5ae46c4e48ee3/Doc/library/dis.rst#L1194 -- ___ Python tracker <https://bugs.python.org/issue41

[issue41888] Duplicate Opcode value in master and 3.9rc2

2020-09-29 Thread anthony shaw
anthony shaw added the comment: Or is this some sort of obscure month python reference!? -- ___ Python tracker <https://bugs.python.org/issue41888> ___ ___ Pytho

[issue41888] Duplicate Opcode value in master and 3.9rc2

2020-09-29 Thread anthony shaw
Change by anthony shaw : -- stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue41888> ___ ___ Python-bugs-list

[issue35488] pathlib Path.match does not behave as described

2018-12-13 Thread anthony shaw
New submission from anthony shaw : The documentation for pathlib PurePath.match(needle) says it accepts "glob-style pattern.". For an absolute path with a recursive pattern (**) it doesn't match correct for more than 1 directory level. All of the assertions in the attached f

[issue35488] pathlib Path.match does not behave as described

2018-12-14 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +10410 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35488> ___ ___ Py

[issue35488] pathlib Path.match does not behave as described

2018-12-14 Thread anthony shaw
anthony shaw added the comment: Raised a PR for the test. Will look into doc PR -- ___ Python tracker <https://bugs.python.org/issue35488> ___ ___ Python-bug

[issue35488] pathlib Path.match does not behave as described

2018-12-15 Thread anthony shaw
anthony shaw added the comment: Yes, this is similar to https://bugs.python.org/issue29249 In that issue, it suggests this feature is not supported, but that is neither documented, nor tested. -- nosy: -serhiy.storchaka ___ Python tracker <ht

[issue35668] low test coverage for idlelib

2019-01-05 Thread anthony shaw
New submission from anthony shaw : idlelib is one of the lesser-tested libraries in cpython: https://codecov.io/gh/python/cpython/tree/master/Lib/idlelib Raising this issue and also volunteering to extend the test module to get coverage across major behaviours and functions that are missing

[issue35668] Improve test coverage for idlelib

2019-01-05 Thread anthony shaw
anthony shaw added the comment: thanks terry, Some great pointers there, I'll review the exiting work and the README doc. With regards to my experience, I have quite extensive experience with python testing. Most of which would be open-source on my Github profile https://githu

[issue35668] Improve test coverage for idlelib

2019-01-05 Thread anthony shaw
anthony shaw added the comment: I was looking at the debugger.py module as being a good place the start, writing test cases for the Idb, Debugger, StackViewer and NamespaceViewer by patching out the dependant components (bdb, Idb, etc. I might start there, raise a PR against it and do a

[issue35668] Improve test coverage for idlelib

2019-01-06 Thread anthony shaw
anthony shaw added the comment: thanks Cheryl, here's my branch https://github.com/tonybaloney/cpython/tree/idlelib_tests I've already seen some code which is 17 years old! -- ___ Python tracker <https://bugs.python.o

[issue35668] Improve test coverage for idlelib

2019-01-06 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +10913 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35668> ___ ___ Py

[issue35668] Improve test coverage for idlelib

2019-01-06 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch, patch pull_requests: +10913, 10914 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35668] Improve test coverage for idlelib

2019-01-06 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch, patch, patch, patch pull_requests: +10913, 10914, 10915, 10916 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35668] Improve test coverage for idlelib

2019-01-06 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch, patch, patch pull_requests: +10913, 10914, 10916 stage: -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35690] IDLE: Fix and test debugger.

2019-01-08 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +10971 stage: needs patch -> patch review ___ Python tracker <https://bugs.python.org/issu

[issue35668] Improve test coverage for idlelib

2019-01-08 Thread anthony shaw
Change by anthony shaw : -- pull_requests: +10972 ___ Python tracker <https://bugs.python.org/issue35668> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35668] Improve test coverage for idlelib

2019-01-08 Thread anthony shaw
Change by anthony shaw : -- pull_requests: +10972, 10973 ___ Python tracker <https://bugs.python.org/issue35668> ___ ___ Python-bugs-list mailing list Unsub

[issue30029] Compiler "'await' outside function" error message is unreachable

2017-04-09 Thread anthony shaw
New submission from anthony shaw: This is related to issue26188, Using await in a simple statement (outside of an async def method) raises SyntaxError with the unhelpful message "invalid syntax". It seems obvious once you've read PEP492 in detail, but I think that as more and

[issue30029] Compiler "'await' outside function" error message is unreachable

2017-04-09 Thread anthony shaw
anthony shaw added the comment: yey! I figured it out!! -- ___ Python tracker <http://bugs.python.org/issue30029> ___ ___ Python-bugs-list mailing list Unsub

[issue30029] Compiler "'await' outside function" error message is unreachable

2017-04-09 Thread anthony shaw
Changes by anthony shaw : -- pull_requests: +1215 ___ Python tracker <http://bugs.python.org/issue30029> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue30029] Compiler "'await' outside function" error message is unreachable

2017-04-09 Thread anthony shaw
Changes by anthony shaw : -- stage: -> resolved status: open -> closed ___ Python tracker <http://bugs.python.org/issue30029> ___ ___ Python-bugs-list

[issue36386] segfault on PyUnicode_DecodeFSDefaultAndSize for uninitialized Py

2019-03-20 Thread anthony shaw
New submission from anthony shaw : If for whatever reason, Py_Initialize() has not been run or failed to run, any call to Py_CompileStringFlags will call PyUnicode_DecodeFSDefault and the reference to interp will be NULL. There is currently no null reference check in

[issue36386] segfault on PyUnicode_DecodeFSDefaultAndSize for uninitialized Py

2019-03-21 Thread anthony shaw
anthony shaw added the comment: This applies to PyUnicode_EncodeFSDefault as well, it has the same issue -- ___ Python tracker <https://bugs.python.org/issue36

[issue36386] segfault on PyUnicode_DecodeFSDefaultAndSize for uninitialized Py

2019-03-21 Thread anthony shaw
anthony shaw added the comment: I'm expecting a "this is not a bug, why would the interpreter not be initialized", but it would be nice to get a friendly error message since this is a public API. IF so, am also happy to submit

[issue36386] segfault on PyUnicode_DecodeFSDefaultAndSize for uninitialized Py

2019-03-21 Thread anthony shaw
anthony shaw added the comment: This is because PyUnicode_DecodeFSDefaultAndSize calls _PyInterpreterState_GET_UNSAFE(), which already documents the potential NULL return value. /* Get the current interpreter state. The macro is unsafe: it does not check for error and it can return

[issue36420] f_trace_opcodes setting and accessing opcodes

2019-03-24 Thread anthony shaw
New submission from anthony shaw : The f_trace_opcodes flag for sys.settrace in 3.7 are proving tricky. I must be missing something but it's not clear how it helps in tracing the opcode about to be executed because it runs before opcode and oparg variables are set by NEXTOPARG(), s

[issue36420] f_trace_opcodes setting and accessing opcodes

2019-03-24 Thread anthony shaw
Change by anthony shaw : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue36420> ___ ___

[issue36420] f_trace_opcodes setting and accessing opcodes

2019-03-24 Thread anthony shaw
anthony shaw added the comment: Took a while, but I worked out a solution: import sys import dis import traceback import io def t(frame, event, args): frame.f_trace_opcodes=True stack = traceback.extract_stack(frame) pad = " "*len(stack) + "|" if event ==

[issue36500] Add "regen-*" equivalent projects for Windows builds

2019-04-01 Thread anthony shaw
New submission from anthony shaw : Now that pgen is written in Python, it'd be useful for Windows users to be able to rebuild grammar and tokens into the parser table. The current hook (make regen-grammar) is built into the Makefile. Add support for VS2017+ vcxproj files to call the s

[issue36500] Add "regen-*" equivalent projects for Windows builds

2019-04-01 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +12583 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36500> ___ ___ Py

[issue36500] Add "regen-*" equivalent projects for Windows builds

2019-04-01 Thread anthony shaw
Change by anthony shaw : -- nosy: +brett.cannon, steve.dower ___ Python tracker <https://bugs.python.org/issue36500> ___ ___ Python-bugs-list mailing list Unsub

[issue36500] Add "regen-*" equivalent projects for Windows builds

2019-04-01 Thread anthony shaw
anthony shaw added the comment: Project now also does: regen-symbol (regenerate Lib/symbol.py) and regen-keyword (regenerate Lib/keyword.py) -- ___ Python tracker <https://bugs.python.org/issue36

[issue36500] Add "regen-*" equivalent projects for Windows builds

2019-04-01 Thread anthony shaw
Change by anthony shaw : -- nosy: +pablogsal ___ Python tracker <https://bugs.python.org/issue36500> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-07 Thread anthony shaw
New submission from anthony shaw : List comprehensions currently create a series of opcodes inside a code object, the first of which is BUILD_LIST with an oparg of 0, effectively creating a zero-length list with a preallocated size of 0. If you're doing a simple list comprehension

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-07 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +12644 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36551> ___ ___ Py

[issue36552] Replace OverflowError with ValueError when calculating length of range objects > PY_SIZE_MAX

2019-04-07 Thread anthony shaw
New submission from anthony shaw : When calculating length of range() objects that have an r->length > PY_SIZE_MAX, the underlying PyLong_AsSsize_t() function will raise an OverflowError: >>> a = list(range(2**256)) Traceback (most recent call last): File "",

[issue36552] Replace OverflowError with ValueError when calculating length of range objects > PY_SIZE_MAX

2019-04-07 Thread anthony shaw
Change by anthony shaw : -- keywords: +patch pull_requests: +12646 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue36552> ___ ___ Py

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-07 Thread anthony shaw
Change by anthony shaw : -- type: -> enhancement ___ Python tracker <https://bugs.python.org/issue36551> ___ ___ Python-bugs-list mailing list Unsubscrib

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: The opcode would not solely apply to this specific use case. I could seek another way of implementing the same behaviour without an additional opcode? -- ___ Python tracker <https://bugs.python.org/issue36

[issue35488] pathlib Path.match does not behave as described

2019-04-08 Thread anthony shaw
Change by anthony shaw : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.or

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > How about converting `[x for x in it]` to `[*it]` in AST? I should have been more explicit, this patch improves the performance of all list comprehensions that don’t have an if clause. Not just [x for x in y] but: d = {} # some sort of dictionary [f

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > This might cause a MemoryError when the __length_hint__ of the source returns > a too large value, even when the actual size of the comprehension is smaller, > e.g.: The current implementation of list comprehensions raise neither a memoryerror or

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > This patch makes it slow for small iterators That is a one-off cost for the __length_hint__ of the range object specifically. Objects with a known length (lists, sets, tuples) would not have that overhead. I can run a more useful set of benchmarks agai

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > In such case, current behavior works. And your patch will raise > OverflowError. Try [x for x in range(2**1000)] in a REPL. It doesn’t raise anything, it tries to create a list that will eventually exceed PY_SIZE_MAX, but it only crashes once it r

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > If your patch uses __length_hint__, it is bug. iterator will return 2**1000 for __length_hint__, but produce no item on iteration. It raises an OverflowError because of the goto https://github.com/python/cpython/pull/12718/files#d

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: > If your patch uses __length_hint__, it is bug. I’m not sure I understand this comment, PEP424 says “This is useful for presizing containers when building from an iterable.“ This patch uses __length_hint__ to presize the list container for a l

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-08 Thread anthony shaw
anthony shaw added the comment: Have just optimized some of the code and pushed another change as 69dce1c552. ran both master and 69dce1c552 using pyperformance with PGO: ➜ ~ python3.8 -m perf compare_to master.json 69dce1c552.json --table

[issue36551] Optimize list comprehensions with preallocate size and protect against overflow

2019-04-09 Thread anthony shaw
anthony shaw added the comment: >I am -1 for this optimization because it affects only one particular case >(neither other kinds of comprehensions, nor generator expressions, nor list >comprehensions with conditions) and even in this case it is small. It is possible to add a lot

[issue36782] Add tests for the datetime C API

2019-05-04 Thread anthony shaw
anthony shaw added the comment: Reserving this issue (in mentored sprint) -- nosy: +anthony shaw ___ Python tracker <https://bugs.python.org/issue36782> ___ ___

[issue36782] Add tests for the datetime C API

2019-05-04 Thread anthony shaw
Change by anthony shaw : -- nosy: +edison.abahurire ___ Python tracker <https://bugs.python.org/issue36782> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue35534] SIGSEGV in stackdepth_walk

2019-05-06 Thread anthony shaw
anthony shaw added the comment: stackdepth_walk no longer exists in Python 3, this is a 2.7 specific issue. opcode_stack_effect in compile.c will have the expected stack effect. If there is a mismatch between the Opcodes compiled with the distribution and the ones in the compile.c

[issue34214] Pylint recusion stack overflow abort

2019-05-06 Thread anthony shaw
anthony shaw added the comment: I agree with Jerome, that handling recursion errors is a part of a 3rd party package and not a bug with CPython. -- nosy: +anthony shaw ___ Python tracker <https://bugs.python.org/issue34

[issue31372] Add SSLSocket.get_verify_result()

2019-05-06 Thread anthony shaw
anthony shaw added the comment: Please review the PR again, some of the code no longer applies as it targets master and the PR is quite old. -- nosy: +anthony shaw ___ Python tracker <https://bugs.python.org/issue31

[issue32430] Simplify Modules/Setup{,.dist,.local}

2019-05-06 Thread anthony shaw
anthony shaw added the comment: PR GH-5062 is still open in GitHub, is this PR still required? -- nosy: +anthony shaw ___ Python tracker <https://bugs.python.org/issue32

[issue31841] Several methods of collections.UserString do not return instances of UserString or its subclasses

2019-05-06 Thread anthony shaw
anthony shaw added the comment: This issue has been open for some time and the PR references an upstream branch that no longer exists. Can this request be closed, or has the conversation yet to be resolved? -- nosy: +anthony shaw ___ Python

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-06 Thread anthony shaw
anthony shaw added the comment: This discussion is inconclusive and targets an old version of CPython, can this issue be closed? -- nosy: +anthony shaw ___ Python tracker <https://bugs.python.org/issue15

[issue15987] Provide a way to compare AST nodes for equality recursively

2019-05-06 Thread anthony shaw
anthony shaw added the comment: Closing issue, PR branch has since been removed and targets Python 3.4 -- nosy: +anthonypjshaw resolution: -> out of date stage: test needed -> resolved status: open -> closed ___ Python tracke

[issue24263] unittest cannot load module whose name starts with Unicode

2019-05-06 Thread anthony shaw
anthony shaw added the comment: The original PR refers to a branch that no longer exists, but the behaviour documented still applies to master. There were some changes to the test loader, but none that fixed this issue. -- nosy: +anthonypjshaw

[issue34820] binascii.c:1578:1: error: the control flow of function ‘binascii_crc32’ does not match its profile data (counter ‘arcs’)

2019-05-06 Thread anthony shaw
anthony shaw added the comment: There is not enough information to triage this issue and since the last request there has been no reply. Closing issue. -- nosy: +anthonypjshaw stage: -> resolved status: open -> closed ___ Python tracker

  1   2   >