[issue46762] assertion failure in f-string parsing Parser/string_parser.c

2022-02-15 Thread Ammar Askar


New submission from Ammar Askar :

Similar to https://bugs.python.org/issue46503 found by the ast.literal_eval 
fuzzer

```
>>> f'{<'
python: Parser/string_parser.c:346: fstring_compile_expr: Assertion `*expr_end 
== '}' || *expr_end == '!' || *expr_end == ':' || *expr_end == '='' failed.
[1]14060 abort  ./python
```

--
assignee: eric.smith
components: Parser
messages: 413302
nosy: ammar2, eric.smith, gregory.p.smith, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: assertion failure in f-string parsing Parser/string_parser.c
type: crash
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue46762>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20949] Missing platform security integrations

2021-12-13 Thread Ammar Askar


Ammar Askar  added the comment:

Hi Jeffrey, your second solution where you omit `-pie` is almost there. Instead 
of modifying the Makefile you can pass `-pie` in `LINKFORSHARED`:


export CFLAGS="-fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2"
export CXXFLAGS="-fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2"
export LDFLAGS="-Wl,-z,noexecstack -Wl,-z,noexecheap -Wl,-z,now -Wl,-z,relro"
export LINKFORSHARED="-pie"

$ checksec ./python
[*] '/home/ammar/workspace/cpython/python'
Arch: amd64-64-little
RELRO:Full RELRO
Stack:Canary found
NX:   NX enabled
PIE:  PIE enabled
FORTIFY:  Enabled

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue20949>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27831] Python 3.4.5 leaks memory when attempting to load non-existent file

2021-12-03 Thread Ammar Askar


Ammar Askar  added the comment:

Looks like this got fixed somewhere along between 3.5 and 3.6


---
3.5
---

./python: can't open file 'id:000109': [Errno 2] No such file or directory

=
==28078==ERROR: LeakSanitizer: detected memory leak



---
3.6
---

./python id:000109 
./python: can't open file 'id:000109': [Errno 2] No such file or directory


Closing as 3.5 is no longer a supported version.

--
nosy: +ammar2
resolution:  -> out of date
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 
<https://bugs.python.org/issue27831>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24709] Unix build uses '-Wno-unused-result', which icc doesn't recognize

2021-12-03 Thread Ammar Askar


Ammar Askar  added the comment:

Looks like the latest versions of icc support this flag: 
https://www.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/compiler-options/compiler-option-details/compiler-diagnostic-options/wunused-variable.html

Closing as outdated.

--
nosy: +ammar2
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue24709>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45494] [fuzzer] Parser null deref with continuation characters and generator parenthesis error

2021-10-16 Thread Ammar Askar


New submission from Ammar Askar :

Another parser crash found by the fuzzer:

"\
"(1for c in I,\
\

Recreator:

>>> import ast
>>> ast.literal_eval('"\\\n"(1for c in I,\\\n\\')
[1]17916 segmentation fault  ./python

>>> import ast
>>> ast.literal_eval(r'''
... "\
... "(1for c in I,\
... \ ''')
[1]17935 segmentation fault  ./python


---
Raw ASAN stacktrace
---

==1668==ERROR: AddressSanitizer: SEGV on unknown address 0x0001 
(pc 0x7f4157e5e08c bp 0x7fffbd48b300 sp 0x7fffbd48aab8 T0)
==1668==The signal is caused by a READ memory access.
==1668==Hint: address points to the zero page.
#0 0x7f4157e5e08c in strchr-avx2.S:57 
/build/glibc-eX1tMB/glibc-2.31/sysdeps/x86_64/multiarch/strchr-avx2.S:57
#1 0x4d7a88 in strchr 
/src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:0
#2 0x9fa6f5 in get_error_line cpython3/Parser/pegen.c:406:25
#3 0x9fa6f5 in _PyPegen_raise_error_known_location 
cpython3/Parser/pegen.c:497:26
#4 0xa18a92 in RAISE_ERROR_KNOWN_LOCATION cpython3/Parser/pegen.h:169:5
#5 0xa331d5 in invalid_arguments_rule cpython3/Parser/parser.c:17831:20
#6 0xa21a87 in arguments_rule cpython3/Parser/parser.c:15462:38
#7 0xa2056b in primary_raw cpython3/Parser/parser.c:12867:18
#8 0xa2056b in primary_rule cpython3/Parser/parser.c:12745:22
#9 0xa1f9cd in await_primary_rule cpython3/Parser/parser.c:12700:28
#10 0xa1f119 in power_rule cpython3/Parser/parser.c:12578:18
#11 0xa1eabc in factor_rule cpython3/Parser/parser.c:12530:26
#12 0xa1dc04 in term_raw cpython3/Parser/parser.c:12373:27
#13 0xa1dc04 in term_rule cpython3/Parser/parser.c:12138:22
#14 0xa1c899 in sum_raw cpython3/Parser/parser.c:12093:25
#15 0xa1c899 in sum_rule cpython3/Parser/parser.c:11975:22
#16 0xa1bb99 in shift_expr_raw cpython3/Parser/parser.c:11936:24
#17 0xa1bb99 in shift_expr_rule cpython3/Parser/parser.c:11818:22
#18 0xa1af2c in bitwise_and_raw cpython3/Parser/parser.c:11779:31
#19 0xa1af2c in bitwise_and_rule cpython3/Parser/parser.c:11700:22
#20 0xa1a49c in bitwise_xor_raw cpython3/Parser/parser.c:11661:32
#21 0xa1a49c in bitwise_xor_rule cpython3/Parser/parser.c:11582:22
#22 0xa1917c in bitwise_or_raw cpython3/Parser/parser.c:11543:32
#23 0xa1917c in bitwise_or_rule cpython3/Parser/parser.c:11464:22
#24 0xa2cd39 in comparison_rule cpython3/Parser/parser.c:10727:18
#25 0xa2c912 in inversion_rule cpython3/Parser/parser.c:10680:31
#26 0xa2b951 in conjunction_rule cpython3/Parser/parser.c:10559:18
#27 0xa258e1 in disjunction_rule cpython3/Parser/parser.c:10473:18
#28 0xa17cb1 in invalid_expression_rule cpython3/Parser/parser.c:18253:18
#29 0xa17cb1 in expression_rule cpython3/Parser/parser.c:9754:39
#30 0xa56979 in expressions_rule cpython3/Parser/parser.c:9628:18
#31 0xa0acf5 in eval_rule cpython3/Parser/parser.c:1035:18
#32 0xa0acf5 in _PyPegen_parse cpython3/Parser/parser.c:33076:18
#33 0xa001a5 in _PyPegen_run_parser cpython3/Parser/pegen.c:1350:9
#34 0xa01fa5 in _PyPegen_run_parser_from_string 
cpython3/Parser/pegen.c:1482:14
#35 0xa80fc9 in _PyParser_ASTFromString cpython3/Parser/peg_api.c:14:21
#36 0x8611ca in Py_CompileStringObject cpython3/Python/pythonrun.c:1371:11
#37 0xc04a8f in builtin_compile_impl cpython3/Python/bltinmodule.c:842:14
#38 0xc04a8f in builtin_compile 
cpython3/Python/clinic/bltinmodule.c.h:249:20
#39 0xb78ade in cfunction_vectorcall_FASTCALL_KEYWORDS 
cpython3/Objects/methodobject.c:446:24
#40 0x57c0ec in _PyObject_VectorcallTstate 
cpython3/Include/internal/pycore_call.h:89:11
#41 0x57c0ec in PyObject_Vectorcall cpython3/Objects/call.c:298:12
#42 0x766191 in call_function cpython3/Python/ceval.c:6619:13
#43 0x748137 in _PyEval_EvalFrameDefault cpython3/Python/ceval.c:4734:19
#44 0x741ae4 in _PyEval_EvalFrame 
cpython3/Include/internal/pycore_ceval.h:48:16
#45 0x741ae4 in _PyEval_Vector cpython3/Python/ceval.c:5810:24
#46 0x57cb50 in _PyFunction_Vectorcall cpython3/Objects/call.c:0
#47 0x57c0ec in _PyObject_VectorcallTstate 
cpython3/Include/internal/pycore_call.h:89:11
#48 0x57c0ec in PyObject_Vectorcall cpython3/Objects/call.c:298:12
#49 0x766191 in call_function cpython3/Python/ceval.c:6619:13
#50 0x748137 in _PyEval_EvalFrameDefault cpython3/Python/ceval.c:4734:19
#51 0x741ae4 in _PyEval_EvalFrame 
cpython3/Include/internal/pycore_ceval.h:48:16
#52 0x741ae4 in _PyEval_Vector cpython3/Python/ceval.c:5810:24
#53 0x57cb50 in _PyFunction_Vectorcall cpython3/Objects/call.c:0
#54 0x57c920 in _PyObject_VectorcallTstate 
cpython3/Include/internal/pycore_call.h:89:11
#55 0x57c920 in PyObject_CallOneArg cpython3/Objects/call.c:375:12
#56 0x579d18 in fuzz_ast_literal_eval 
cpython3/Modules/_xxt

[issue45408] [fuzzer] Weird input with continuation and newlines causes null deref in parser

2021-10-07 Thread Ammar Askar

New submission from Ammar Askar :

>From the newly added ast.literal_eval(x) fuzzer, the following string fed to 
>ast.literal_eval will cause a null pointer in get_error_line:

\
(\
\

This can be recreated with:

❯ ./python  
Python 3.11.0a1+ (heads/fuzz_ast-dirty:6c942a86a4, Oct  6 2021, 16:27:52) [GCC 
8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> ast.literal_eval(r'''\
... \
... (\
... \ ''')
[1]15464 segmentation fault  ./python


---
Raw ASAN report
---

==85015==ERROR: AddressSanitizer: SEGV on unknown address 
0x0001 (pc 0x7f987730e08c bp 0x7fff7f8e8080 sp 0x7fff7f8e7838 T0)
==85015==The signal is caused by a READ memory access.
==85015==Hint: address points to the zero page.
#0 0x7f987730e08c in strchr-avx2.S:57 
/build/glibc-eX1tMB/glibc-2.31/sysdeps/x86_64/multiarch/strchr-avx2.S:57
#1 0x4d7a58 in strchr 
/src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc:0
#2 0x9f9d95 in get_error_line cpython3/Parser/pegen.c:406:25
#3 0x9f9d95 in _PyPegen_raise_error_known_location 
cpython3/Parser/pegen.c:497:26
#4 0x9fd492 in RAISE_ERROR_KNOWN_LOCATION cpython3/Parser/pegen.h:169:5
#5 0xa00528 in raise_unclosed_parentheses_error 
cpython3/Parser/pegen.c:267:8
#6 0xa00528 in _PyPegen_check_tokenizer_errors 
cpython3/Parser/pegen.c:1314:25
#7 0x9ff9e3 in _PyPegen_run_parser cpython3/Parser/pegen.c:1352:17
#8 0xa015c5 in _PyPegen_run_parser_from_string 
cpython3/Parser/pegen.c:1479:14
#9 0xa805e9 in _PyParser_ASTFromString cpython3/Parser/peg_api.c:14:21
#10 0x85f01a in Py_CompileStringObject cpython3/Python/pythonrun.c:1371:11
#11 0xc0785f in builtin_compile_impl cpython3/Python/bltinmodule.c:841:14
#12 0xc0785f in builtin_compile 
cpython3/Python/clinic/bltinmodule.c.h:249:20
#13 0xb7b28e in cfunction_vectorcall_FASTCALL_KEYWORDS 
cpython3/Objects/methodobject.c:446:24
#14 0x764f22 in call_function cpython3/Python/ceval.c:0
#15 0x7482e6 in _PyEval_EvalFrameDefault cpython3/Python/ceval.c:4614:19
#16 0x741225 in _PyEval_EvalFrame 
cpython3/Include/internal/pycore_ceval.h:46:12
#17 0x741225 in _PyEval_Vector cpython3/Python/ceval.c:5636:24
#18 0x57c510 in _PyFunction_Vectorcall cpython3/Objects/call.c:0
#19 0x764f22 in call_function cpython3/Python/ceval.c:0
#20 0x7482e6 in _PyEval_EvalFrameDefault cpython3/Python/ceval.c:4614:19
#21 0x741225 in _PyEval_EvalFrame 
cpython3/Include/internal/pycore_ceval.h:46:12
#22 0x741225 in _PyEval_Vector cpython3/Python/ceval.c:5636:24
#23 0x57c510 in _PyFunction_Vectorcall cpython3/Objects/call.c:0
#24 0x579def in _PyObject_VectorcallTstate 
/workspace/out/libfuzzer-address-x86_64/include/python3.11/cpython/abstract.h:114:11
#25 0x579def in PyObject_CallOneArg 
/workspace/out/libfuzzer-address-x86_64/include/python3.11/cpython/abstract.h:184:12
#26 0x579def in fuzz_ast_literal_eval 
cpython3/Modules/_xxtestfuzz/fuzzer.c:425:25
#27 0x579def in _run_fuzz cpython3/Modules/_xxtestfuzz/fuzzer.c:443:14
#28 0x579def in LLVMFuzzerTestOneInput 
cpython3/Modules/_xxtestfuzz/fuzzer.c:565:11
#29 0x4725e3 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, 
unsigned long) cxa_noexception.cpp:0
#30 0x45deb2 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned 
long) /src/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:324:6
#31 0x463965 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char 
const*, unsigned long)) cxa_noexception.cpp:0
#32 0x48c6b2 in main 
/src/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
#33 0x7f98771aa0b2 in __libc_start_main 
/build/glibc-eX1tMB/glibc-2.31/csu/libc-start.c:308:16
#34 0x43b16d in _start
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/lib/x86_64-linux-gnu/libc.so.6+0x18b08c)
==85015==ABORTING

--
components: Parser
messages: 403427
nosy: ammar2, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: [fuzzer] Weird input with continuation and newlines causes null deref in 
parser
type: crash
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue45408>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35970] no help flag in base64 util

2021-10-06 Thread Ammar Askar


Change by Ammar Askar :


--
components: +Library (Lib)
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement
versions: +Python 3.11

___
Python tracker 
<https://bugs.python.org/issue35970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29505] Submit the re, json, csv, & struct modules to oss-fuzz testing

2021-10-06 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +27111
pull_request: https://github.com/python/cpython/pull/28777

___
Python tracker 
<https://bugs.python.org/issue29505>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue35970] no help flag in base64 util

2021-10-06 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
nosy: +ammar2
nosy_count: 1.0 -> 2.0
pull_requests: +27109
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/28774

___
Python tracker 
<https://bugs.python.org/issue35970>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45006] Add data_offset field to ZipInfo

2021-10-06 Thread Ammar Askar


Ammar Askar  added the comment:

Could you explain your use-case for this feature in a bit more detail? zipfile 
is meant to be a relatively high level library to do common tasks such as 
reading/writing/listing files.

The use case for `data_offset` proposed here seems to be relatively advanced 
and I don't see how it would be to useful for the vast majority of users.


(Without adding to the public API, I think you can achieve a pretty similar 
functionality by using the following)

compressed_data = zipfile.open(zipinfo)._read2(compressed_size)

Obviously, this relies on undocumented internals, but for a niche use case that 
might not be the worst thing: 
https://github.com/python/cpython/blob/61892c04764e1f3a659bbd09e6373687a27d36e2/Lib/zipfile.py#L1042-L1056

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue45006>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34990] year 2038 problem in compileall.py

2021-08-24 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10, Python 3.11 -Python 3.5, Python 3.6, Python 3.7, Python 
3.8

___
Python tracker 
<https://bugs.python.org/issue34990>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34990] year 2038 problem in compileall.py

2021-08-24 Thread Ammar Askar


Ammar Askar  added the comment:


New changeset 0af681b652c43f0ba90988400ecc1e7934fbfc5d by Miss Islington (bot) 
in branch '3.10':
[3.10] bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int 
(GH-19708)
https://github.com/python/cpython/commit/0af681b652c43f0ba90988400ecc1e7934fbfc5d


--

___
Python tracker 
<https://bugs.python.org/issue34990>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34990] year 2038 problem in compileall.py

2021-08-24 Thread Ammar Askar


Ammar Askar  added the comment:


New changeset 9d3b6b2472f7c7ef841e652825de652bc8af85d7 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-34990: Treat the pyc header's mtime in compileall as an unsigned int 
(GH-19708)
https://github.com/python/cpython/commit/9d3b6b2472f7c7ef841e652825de652bc8af85d7


--

___
Python tracker 
<https://bugs.python.org/issue34990>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41886] PyType_Type is documented incorrectly

2021-08-03 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you for spotting this and the patch da-woods!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.9

___
Python tracker 
<https://bugs.python.org/issue41886>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41886] PyType_Type is documented incorrectly

2021-08-03 Thread Ammar Askar


Ammar Askar  added the comment:


New changeset ac811f9b5a68ce8756911ef2c8be83b46696018f by da-woods in branch 
'main':
bpo-41886: Fix documented type of PyType_Type (GH-22454)
https://github.com/python/cpython/commit/ac811f9b5a68ce8756911ef2c8be83b46696018f


--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue41886>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41886] PyType_Type is documented incorrectly

2021-08-03 Thread Ammar Askar


Change by Ammar Askar :


--
versions: +Python 3.11 -Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 
<https://bugs.python.org/issue41886>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2021-07-27 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +25923
pull_request: https://github.com/python/cpython/pull/27390

___
Python tracker 
<https://bugs.python.org/issue34013>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-20 Thread Ammar Askar


Ammar Askar  added the comment:

Indeed, and the unicode_width package seems to implement the wcwidth algorithm:

* https://github.com/unicode-rs/unicode-width/blob/master/src/tables.rs#L39-L48
* https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c

https://bugs.python.org/issue12568 is an issue from the past that proposed 
adding wcwidth to the standard library.

--

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-19 Thread Ammar Askar


Ammar Askar  added the comment:

I think this is the previous issue you are talking about Terry. 
https://bugs.python.org/issue24665

The correct algorithm is a little more complex than just using 
east_asian_widths. Ideally we would like to use the wcwidth function 
(https://man7.org/linux/man-pages/man3/wcwidth.3.html) which implements all the 
logic to somewhat properly figure out widths.

Given Terry's comments from above and the previous issues I'm starting to think 
the fix for this issue might not be worth the added complexity.

--

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-19 Thread Ammar Askar

Ammar Askar  added the comment:

Had some time to look into this. Just to summarize this problem, it deals with 
unicode points that are single characters but take up more than the width of a 
single character, even with a monospace font [1].

In the examples from above, the Chinese character itself counts as one 
character in a Python string. However, notice that it needs two carets:

>>> x = "该"
>>> print(x)
该
>>> len(x)
1
>>> print(x + '\n' + '^^')
该
^^

This issue is somewhat font dependent, in the case of the emoji I know that 
windows sometimes renders emojis as single-character wide black-and-white 
glyphs or colorful ones depending on the program.

As Pablo alluded to, unicodedata.east_asian_width is probably the best solution 
we can implement. For these wide characters it provides:

>>> unicodedata.east_asian_width('💩')
'W'
>>> unicodedata.east_asian_width('该')
'W'

W corresponding to Wide. Whereas for regular width characters:

>>> unicodedata.east_asian_width('b')
'Na'
>>> unicodedata.east_asian_width('=')
'Na'

we get Neutral (Not East Asian). This can be used to count the "displayed 
width" of the characters and hence the carets. However, organization is going 
to be a bit tricky since we're currently using 
_PyPegen_byte_offset_to_character_offset to get offsets to use for string 
slicing in the ast segment parsing code. We might have to make a separate 
function that gets the font display-width.

-

[1] Way more details on this issue here: 
https://denisbider.blogspot.com/2015/09/when-monospace-fonts-arent-unicode.html 
and an example of a Python library that tries to deal with this issue here: 
https://github.com/jquast/wcwidth

--

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-16 Thread Ammar Askar


Ammar Askar  added the comment:

Aah, I won't have time to investigate until Monday. I'll take a look then 
unless someone gets to it first :)

--

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-16 Thread Ammar Askar

Ammar Askar  added the comment:

As reported by Will McGugan on twitter:

Printing may be wrong for some unicode characters like:


Traceback (most recent call last):
  File "test.py", line 1, in 
x = ("该" / 0) + (1 / 2)
 ~~^
TypeError: unsupported operand type(s) for /: 'str' and 'int'


and


Traceback (most recent call last):
  File "test.py", line 3, in 
x = ("💩" / 0) + (1 / 2)
 ~~~
TypeError: unsupported operand type(s) for /: 'str' and 'int'

--

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44624] Script name for venv PowerShell activate

2021-07-13 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 
<https://bugs.python.org/issue44624>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44612] inspect module points that could be using f-String

2021-07-12 Thread Ammar Askar


Ammar Askar  added the comment:

Thanks for trying to help Leonardo! You might consider looking for easy issues 
on the bug tracker or reviewing open pull requests to help. Definitely take a 
look at the dev guide :) https://cpython-devguide.readthedocs.io/fixingissues/

--
resolution:  -> rejected
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue44612>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44600] match/case statements trace incorrectly in 3.10.0b4

2021-07-12 Thread Ammar Askar


Ammar Askar  added the comment:

Brandt, maybe this regression test from a previous tracing bug might be useful 
for the test writing: 
https://github.com/python/cpython/pull/22026/files#diff-8b73bfc55514d8add8904c5f4d1d24b7b644ebfccba8d846085303577aa94dd6

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue44600>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44612] inspect module points that could be using f-String

2021-07-12 Thread Ammar Askar


Ammar Askar  added the comment:

As per https://bugs.python.org/issue36249 and https://bugs.python.org/issue38351

We don't generally do large-scale changes that are mostly formatting based. We 
would prefer that these sort of improvements happen when someone happens to be 
touching that code anyway unless there is a demonstrable improvement from them.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue44612>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-06 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +25603
pull_request: https://github.com/python/cpython/pull/27047

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44569] traceback.py: Allow customization of per-frame line formatting in StackSummary

2021-07-05 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
pull_requests: +25598
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/27038

___
Python tracker 
<https://bugs.python.org/issue44569>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44569] traceback.py: Allow customization of per-frame line formatting in StackSummary

2021-07-05 Thread Ammar Askar


New submission from Ammar Askar :

During the implementation of PEP 657, Terry Jan Reedy pointed out that in the 
format method of traceback.StackSummary there are two roles being fulfilled, 
there is some logic to handle omitting repeated lines involved in recursive 
calls and then the core per-frame formatting logic:
 
https://github.com/python/cpython/blob/17f94e28882e1e2b331ace93f42e8615383dee59/Lib/traceback.py#L484-L503

To allow the per-line formatting to be overridden easily, these lines should be 
split into a separate method.

--
assignee: ammar2
components: Library (Lib)
messages: 397009
nosy: BTaskaya, ammar2, pablogsal, terry.reedy
priority: normal
severity: normal
status: open
title: traceback.py: Allow customization of per-frame line formatting in 
StackSummary
versions: Python 3.11

___
Python tracker 
<https://bugs.python.org/issue44569>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-04 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +25582, 25583
pull_request: https://github.com/python/cpython/pull/27023

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-04 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +25582, 25583, 25584
pull_request: https://github.com/python/cpython/pull/27023

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-07-04 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +25582
pull_request: https://github.com/python/cpython/pull/27023

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43950] Include column offsets for bytecode instructions

2021-06-29 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +ammar2
nosy_count: 8.0 -> 9.0
pull_requests: +25524
pull_request: https://github.com/python/cpython/pull/26958

___
Python tracker 
<https://bugs.python.org/issue43950>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44349] Edge case in compiler when error displaying with non-utf8 lines

2021-06-08 Thread Ammar Askar


Change by Ammar Askar :


--
title: Edge case in when error displaying with non-utf8 lines -> Edge case in 
compiler when error displaying with non-utf8 lines

___
Python tracker 
<https://bugs.python.org/issue44349>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44349] Edge case in pegen's error displaying with non-utf8 lines

2021-06-08 Thread Ammar Askar

New submission from Ammar Askar :

The AST currently stores column offsets for characters as byte-offsets. 
However, when displaying errors, these byte-offsets must be turned into 
character-offsets so that the characters line up properly with the characters 
on the line when printed. This is done with the function 
`byte_offset_to_character_offset` 
(https://github.com/python/cpython/blob/fdc7e52f5f1853e350407c472ae031339ac7f60c/Parser/pegen.c#L142-L161)
 which assumes that the line is UTF8 encoded.

However, consider a file like this:

  '¢¢¢¢¢¢' + f(4, 'Hi' for x in range(1)) # This line has a SyntaxError

This prints

  File "test-normal.py", line 1
'¢¢¢¢¢¢' + f(4, 'Hi' for x in range(1)) # This line has a SyntaxError
  ^^
  SyntaxError: Generator expression must be parenthesized

as expected.


However if we use a custom source encoding line:

  # -*- coding: cp437 -*-
  '¢¢¢¢¢¢' + f(4, 'Hi' for x in range(1)) # This line has a SyntaxError

it ends up printing out

  File "C:\Users\ammar\junk\test-utf16.py", line 2
'¢¢' + f(4, 'Hi' for x in range(1)) # This line has a SyntaxError
  ^^
  SyntaxError: Generator expression must be parenthesized

where the carets/offsets are misaligned with the actual characters. This is 
because the string "¢" has the display width of 2 characters and encodes to 2 
bytes in cp437 but when interpreted as utf-8 is the single character "¢" with a 
display width of 1.

Note that this edge case is relatively hard to trigger because ordinarily what 
will happen here is that the call to PyErr_ProgramTextObject will fail because 
it tries to decode the line as utf-8: 
https://github.com/python/cpython/blob/ae3c66acb89a6104fcd0eea760f80a0287327cc4/Python/errors.c#L1693-L1696
 after which the error handling logic uses the tokenizer's internal buffer 
which has a proper utf-8 string.
So this bug requires the input to be valid as both utf-8 and the source 
encoding.

(Discovered while implementing PEP 657 
https://github.com/colnotab/cpython/issues/10)

--
components: Parser
messages: 395347
nosy: ammar2, lys.nikolaou, pablogsal
priority: normal
severity: normal
status: open
title: Edge case in pegen's error displaying with non-utf8 lines
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue44349>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44184] crash on windows invoking flake8

2021-05-21 Thread Ammar Askar


Ammar Askar  added the comment:

Indeed, it's quite a tricky issue so I'm glad it was caught in the beta.

Thank you for the report Anthony. Thanks for tracing the root cause and the fix 
Victor and thank you to everyone who helped debug.

--

___
Python tracker 
<https://bugs.python.org/issue44184>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

Just to thicken the mystery a bit further, if you comment out

import inspect

in dataclasses.py, the error also goes away.

--

___
Python tracker 
<https://bugs.python.org/issue44184>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

The bisect was bizarre to say the least...

It points to commit 11159d2c9d6616497ef4cc62953a5c3cc8454afb

bpo-43080: pprint for dataclass instances (GH-24389)
* Added pprint support for dataclass instances which don't have a custom 
__repr__.

which doesn't touch any C code by itself and isn't the heap type conversions.

If I check out to latest 3.10 and revert that commit, this issue seems to go 
away. Can someone else confirm just to make sure the bisect was done correctly?

--

___
Python tracker 
<https://bugs.python.org/issue44184>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

The segfault seems to be occuring on typeobject.c:1456 during interpreter 
finalization:

if (type->tp_flags & Py_TPFLAGS_HEAPTYPE && !(base->tp_flags & 
Py_TPFLAGS_HEAPTYPE))

where `type` seems to have already been deallocated.

Here's the stack trace:

python310.dll!subtype_dealloc(_object * self) Line 1456 C
[Inline Frame] python310.dll!_Py_Dealloc(_object *) Line 2288   C
[Inline Frame] python310.dll!_Py_DECREF(_object *) Line 500 C
[Inline Frame] python310.dll!_Py_XDECREF(_object * op) Line 567 C
>   python310.dll!dict_dealloc(PyDictObject * mp) Line 2067 C
[Inline Frame] python310.dll!_Py_Dealloc(_object *) Line 2288   C
[Inline Frame] python310.dll!_Py_DECREF(_object *) Line 500 C
python310.dll!ast_clear(AST_object * self) Line 784 C
python310.dll!delete_garbage(_ts * tstate, _gc_runtime_state * gcstate, 
PyGC_Head * collectable, PyGC_Head * old) Line 1018 C
python310.dll!gc_collect_main(_ts * tstate, int generation, __int64 * 
n_collected, __int64 * n_uncollectable, int nofail) Line 1304 C
[Inline Frame] python310.dll!_PyGC_CollectNoFail(_ts *) Line 2123   
C
python310.dll!interpreter_clear(_is * interp, _ts * tstate) Line 326
C
[Inline Frame] python310.dll!_PyInterpreterState_Clear(_ts *) Line 358  
C
python310.dll!finalize_interp_clear(_ts * tstate) Line 1639 C
python310.dll!Py_FinalizeEx() Line 1813 C
[Inline Frame] python310.dll!Py_RunMain() Line 668  C
[Inline Frame] python310.dll!pymain_main(_PyArgv *) Line 696C
python310.dll!Py_Main(int argc, wchar_t * * argv) Line 708  C

--

___
Python tracker 
<https://bugs.python.org/issue44184>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44184] crash on windows invoking flake8

2021-05-20 Thread Ammar Askar


Ammar Askar  added the comment:

Can recreate on the latest 3.10 checkout, taking a look.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue44184>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40222] "Zero cost" exception handling

2021-05-09 Thread Ammar Askar


Ammar Askar  added the comment:

Seconded, also seeing the same ASAN failure on the fuzzers with a blame for 
this commit.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue40222>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44006] symbol documentation still exists

2021-05-03 Thread Ammar Askar


Ammar Askar  added the comment:

Also, would it make sense to do a clean build (with the html output folder 
wiped) in the build-cron to avoid this happening in the future?

--

___
Python tracker 
<https://bugs.python.org/issue44006>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44006] symbol documentation still exists

2021-05-02 Thread Ammar Askar


Ammar Askar  added the comment:

Added Julien to the nosy list, looks like we might be retaining old deleted 
docs pages.

--
nosy: +ammar2, mdk

___
Python tracker 
<https://bugs.python.org/issue44006>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43982] Code coverage on the CI: validate codecov shell script checksum

2021-04-30 Thread Ammar Askar


Ammar Askar  added the comment:

With issue43888 being fixed with the removal of the coverage build, this is now 
obsolete. Thanks for pointing out the codecov breach, we will make sure to 
follow this if we ever re-add codecov.

--
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue43982>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43888] GitHub Actions CI/CD `Coverage` job is broken on master

2021-04-30 Thread Ammar Askar


Ammar Askar  added the comment:

Coverage builds have been removed from the CI, closing this now.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue43888>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43982] Code coverage on the CI: validate codecov shell script checksum

2021-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

See also https://github.com/python/cpython/pull/25679 where we're proposing 
just removing the coverage build altogether.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue43982>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43565] PyUnicode_KIND macro does not has specified return type

2021-04-29 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
nosy: +ammar2
nosy_count: 4.0 -> 5.0
pull_requests: +24416
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25724

___
Python tracker 
<https://bugs.python.org/issue43565>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43614] Search is not beginner friendly

2021-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

Just a little update to this, now that issue34398 is fixed it is possible to 
make this more beginner friendly by making sure the right terms have glossary 
entries.

As an example, here is a search for "argument" on the latest docs:

https://docs.python.org/3.10/search.html?q=argument

It would be nice if kwargs/args could also point to that.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue43614>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43899] separate builtin function

2021-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

Note that the `more_itertools` package on pypi also has a partition method.

Shall we close this off given that a recipe is already present and this is 
available as part of a popular 3rd-party library?

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue43899>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43888] GitHub Actions CI/CD `Coverage` job is broken on master

2021-04-27 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +24370
pull_request: https://github.com/python/cpython/pull/25679

___
Python tracker 
<https://bugs.python.org/issue43888>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43888] GitHub Actions CI/CD `Coverage` job is broken on master

2021-04-24 Thread Ammar Askar


Ammar Askar  added the comment:

For what it's worth I think Brett's suggestion of just removing the coverage 
build entirely is good too since it seems like no one actually looks at the 
results and they take up valuable CI time.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue43888>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38659] enum classes cause slow startup time

2021-04-21 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +24234
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/25516

___
Python tracker 
<https://bugs.python.org/issue38659>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38659] enum classes cause slow startup time

2021-04-21 Thread Ammar Askar


Ammar Askar  added the comment:

Looks like this is the issue described in the comment here: 
https://github.com/python/cpython/blob/master/Lib/test/test_enum.py#L3691-L3692

On the first run you have the correct

  ('CONVERT_STRING_TEST_NAME_A', 5)

but later it turns into

  ('CONVERT_STRING_TEST_NAME_A', test.test_enum.CONVERT_STRING_TEST_NAME_A)

causing double-conversions of the enum elements. This causes the format(x) test 
to fail. You can re-create the same issue outside of the refleak by adding a 
simple:

def test_convert_repr_and_str_again(self):
self.test_convert_repr_and_str()

method.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue38659>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Ammar Askar


Ammar Askar  added the comment:

Opened https://github.com/python/cpython/pull/25469 for the first suggestion of 
reversing the precedence table order since it seems like a good improvement. I 
think the tight binding to weak order is more natural and aside from K&R, the 
following other languages also follow the same ordering:

* Javascript - 
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#table
* PHP - https://www.php.net/manual/en/language.operators.precedence.php
* Rust - 
https://doc.rust-lang.org/reference/expressions.html#expression-precedence

--

___
Python tracker 
<https://bugs.python.org/issue43837>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43837] Operator precedence documentation could be more clear

2021-04-18 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
nosy: +ammar2
nosy_count: 8.0 -> 9.0
pull_requests: +24194
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25469

___
Python tracker 
<https://bugs.python.org/issue43837>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43836] range.index doesn't support start/stop optional arguments

2021-04-14 Thread Ammar Askar


Ammar Askar  added the comment:

Marked as a duplicate.

Kaleb, would you mind posting your comment on the original bug #28197?

--
nosy: +ammar2
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Add start and stop parameters to the range.index() ABC method

___
Python tracker 
<https://bugs.python.org/issue43836>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43705] [docs] Document that SyntaxError's offsets are 1-indexed

2021-04-03 Thread Ammar Askar


Ammar Askar  added the comment:

Aah thanks for pointing that out Terry, I didn't realize f-strings have 
different semantics for SyntaxError. Would you mind making a separate issue for 
that, I'll look into making the documentation for it clearer after I get a 
chance to investigate.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 
<https://bugs.python.org/issue43705>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43705] [docs] Document that SyntaxError's offsets are 1-indexed

2021-04-02 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
pull_requests: +23900
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25153

___
Python tracker 
<https://bugs.python.org/issue43705>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43705] [docs] Document that SyntaxError's offsets are 1-indexed

2021-04-02 Thread Ammar Askar


New submission from Ammar Askar :

As pointed out by Guido in https://bugs.python.org/issue43555, we switched to 
making the column offsets for SyntaxError be 1-indexed consistently in 
https://bugs.python.org/issue34683

The rationale is explained by Guido and expanded upon in follow up comments 
here: https://github.com/python/cpython/pull/9338#pullrequestreview-155989089 

This property however was not actually ever added to SyntaxError's 
documentation: https://docs.python.org/3/library/exceptions.html#SyntaxError

--
assignee: docs@python
components: Documentation
messages: 390081
nosy: ammar2, docs@python, gvanrossum, terry.reedy
priority: normal
severity: normal
status: open
title: [docs] Document that SyntaxError's offsets are 1-indexed
versions: Python 3.9

___
Python tracker 
<https://bugs.python.org/issue43705>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40012] Avoid Python 2 documentation to appear in Web search results

2021-04-02 Thread Ammar Askar


Ammar Askar  added the comment:

This has been fixed as part of 
https://github.com/python/docsbuild-scripts/pull/99

Thank you to Julien, our Google results are much cleaner now :)

--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40012>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29505] Submit the re, json, csv, & struct modules to oss-fuzz testing

2021-04-02 Thread Ammar Askar


Ammar Askar  added the comment:

All the modules prescribed in the original bug are now actively being fuzzed, 
thank you to Devin for the original work on this and Gregory for reviewing all 
these changes.

I'm closing this now, feel free to make a new bug and nosy me in if there are 
any other C-based modules commonly exposed to user input that should be fuzzed.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue29505>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41283] The parameter name for imghdr.what in the documentation is wrong

2021-04-02 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41283>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40705] use-after-free in _zoneinfo.c's module_free function

2021-04-02 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40705>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40932] subprocess docs should warn of shlex use on Windows

2021-04-02 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you Steve and Zachary for reviewing, this warning is in the docs now.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue40932>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34398] Docs search should prominently show definitions and glossary items

2021-04-02 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you to Julien for reviewing, we ended up going with our own solution 
instead of waiting on Sphinx and I think it looks good :)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue34398>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41670] ceval traces code differently with USE_COMPUTED_GOTOS

2021-04-02 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue41670>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue26702] A better assert statement

2021-03-28 Thread Ammar Askar


Ammar Askar  added the comment:

Just a note and possible design inspiration, pytest has pretty assertions like 
this to allowing you to write unit tests purely with the assert statement and 
not unittest's special `assert...` methods: 
https://docs.pytest.org/en/stable/example/reportingdemo.html#tbreportdemo

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue26702>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43601] Tools/c-analyzer/check-c-globals.py run throw exception err

2021-03-23 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +eric.snow

___
Python tracker 
<https://bugs.python.org/issue43601>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43555] Location of SyntaxError with new parser missing (after continuation character)

2021-03-22 Thread Ammar Askar


Ammar Askar  added the comment:

> We should definitely document the column offset being 1-based

Yes please, I remember working on that issue to make it consistently 1-based a 
while ago and I remember that the tooling was relying on 1-based indexes for 
column offsets.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue43555>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +23661
pull_request: https://github.com/python/cpython/pull/24896

___
Python tracker 
<https://bugs.python.org/issue43499>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Ammar Askar  added the comment:

Sure thing, I'll work on the backport.

--

___
Python tracker 
<https://bugs.python.org/issue43499>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Change by Ammar Askar :


--
pull_requests: +23658
pull_request: https://github.com/python/cpython/pull/20508

___
Python tracker 
<https://bugs.python.org/issue43499>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43499] Compiler warnings in building Python 3.9 on Windows

2021-03-16 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +ammar2
nosy_count: 1.0 -> 2.0
pull_requests: +23657
pull_request: https://github.com/python/cpython/pull/20628

___
Python tracker 
<https://bugs.python.org/issue43499>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43403] Misleading statement about bytes not being able to represent windows filenames in documentation

2021-03-04 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +eryksun

___
Python tracker 
<https://bugs.python.org/issue43403>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43144] test_unicodedata: test_normalization uses network but doesn't depend on network resource

2021-02-25 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +ammar2
nosy_count: 3.0 -> 4.0
pull_requests: +23435
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24650

___
Python tracker 
<https://bugs.python.org/issue43144>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Ammar Askar


Ammar Askar  added the comment:

It's still one of the most common beginner mistakes, personally I think the 
trade-off in complexity at least for the grammar level fix is worth it here.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue34013>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42773] build.yml workflow not testing on pushes

2021-02-04 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 
<https://bugs.python.org/issue42773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42628] binascii doesn't work on some base64

2021-01-27 Thread Ammar Askar


Ammar Askar  added the comment:

It seems to me that your commands are just sequenced wrong, in Python you're 
performing (examples in parens):

* base64 (ue==) -> decode to binary (0xB9)
* binary (0xB9) -> encode to base64 (uQ==)

whereas in your command line commands you're doing:

* base64 (ue==) -> encode to double base64 (dWU9PQo=)
* double base64 (dWU9PQo=) -> decoded to base64 (ue==)


If we do the same thing on the command line as you're doing in Python, we get:

$ echo "base64encodedvalue==" | base64 -d | base64
base64encodedvaluQ==

$ echo "ue==" | base64 -d | base64
uQ==

$ echo "base64encodedvalue==" | openssl enc -d -base64 -A | openssl enc -base64 
-A
base64encodedvaluQ==

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42628>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42903] optimize lru_cache for functions with no arguments

2021-01-11 Thread Ammar Askar


Ammar Askar  added the comment:

Additional discussion on the same topic on discourse: 
https://discuss.python.org/t/reduce-the-overhead-of-functools-lru-cache-for-functions-with-no-parameters/3956

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2021-01-09 Thread Ammar Askar


Ammar Askar  added the comment:

`tb_frame` is documented under 
https://docs.python.org/3/reference/datamodel.html

> Special read-only attributes: tb_frame points to the execution frame of the 
> current level

`tb_code` can similarly be documented here and the note about the audit event 
can be added. Thanks for the patch Ryan, would you like to add the 
documentation change Steve suggested and create a pull request out of it and 
contribute it? (https://devguide.python.org/pullrequest/)

--

___
Python tracker 
<https://bugs.python.org/issue42800>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42825] Build libraries with "/OPT:REF" linker optimization on Windows

2021-01-05 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +eryksun
title: Optimization opportunity on Windows -> Build libraries with "/OPT:REF" 
linker optimization on Windows

___
Python tracker 
<https://bugs.python.org/issue42825>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42800] Traceback objects allow accessing frame objects without triggering audit hooks

2020-12-31 Thread Ammar Askar


New submission from Ammar Askar :

It is possible to access all the frame objects in the interpret without 
triggering any audit hooks through the use of exceptions. Namely, through the 
traceback's tb_frame property. Ordinarily one would trigger the 
"sys._current_frames" or "sys._getframe" event but this code path bypasses 
those.

There is already precedent for raising events for certain sensitive properties 
such as `__code__` in funcobject. (through a "object.__getattr__" event) so 
perhaps this property should be protected in a similar way.


This issue was recently demonstrated in a security competition:
* https://github.com/hstocks/ctf_writeups/blob/master/2020/hxp/audited/README.md
* https://github.com/fab1ano/hxp-ctf-20/blob/master/audited/README.md

--
assignee: steve.dower
components: Library (Lib)
keywords: security_issue
messages: 384143
nosy: ammar2, christian.heimes, steve.dower
priority: normal
severity: normal
status: open
title: Traceback objects allow accessing frame objects without triggering audit 
hooks
type: security
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue42800>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42773] build.yml workflow not testing on pushes

2020-12-30 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you Filipe and Mariatta, the fix looks good to me. I think it needs a 
backport to the 3.9 branch though.

--

___
Python tracker 
<https://bugs.python.org/issue42773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42773] build.yml workflow not testing on pushes

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

Any commit that gets to pushed to the master, 3.9, 3.8 and 3.7 branches.

e.g all the commits here https://github.com/python/cpython/commits/master, they 
end up failing the "Check for source changes" step and skipping even when 
there's non-documentation changes.

--
versions: +Python 3.7, Python 3.8

___
Python tracker 
<https://bugs.python.org/issue42773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42773] build.yml workflow not testing on pushes

2020-12-28 Thread Ammar Askar


New submission from Ammar Askar :

It looks like on pushes to Github, we currently aren't running tests. (Though 
this isn't too big of a concern since they get run on pull requests).

Here's an example of a recent run 
https://github.com/python/cpython/runs/1609911031

```
fatal: ambiguous argument 'origin/..': unknown revision or path not in the 
working tree.
Use '--' to separate paths from revisions, like this:
'git  [...] -- [...]'
```

--
components: Build
messages: 383935
nosy: FFY00, Mariatta, ammar2, vstinner
priority: normal
severity: normal
status: open
title: build.yml workflow not testing on pushes
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 
<https://bugs.python.org/issue42773>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42739] Crash when try to disassemble bogus code object

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

This seems to be part 2 of the problems Mark mentioned in issue42562. Namely in 
this case the `co_lnotab` accessor uses PyLineTable_NextAddressRange which has 
that assertion.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42739>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42770] Typo in email.headerregistry docs

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

Confirmed, the attribute under 
https://docs.python.org/3.10/library/email.headerregistry.html#email.headerregistry.ContentDispositionHeader
 is incorrect.

bazwal, would you like to propose a patch to fix this? The code is here: 
https://github.com/python/cpython/blob/master/Doc/library/email.headerregistry.rst

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42770>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42767] Review usage of atomic variables in signamodule.c

2020-12-28 Thread Ammar Askar


Ammar Askar  added the comment:

> For me, the most surprising part is Handlers[signum].tripped which is 
> declared as volatile *and* an atomic variable.

I think it's just following this part of the C spec (Some background in 
bpo-12060):

> or refers to any object with static storage duration other than by assigning 
> a value to a static storage duration variable of type volatile sig_atomic_t. 
> Furthermore, if such a call fails, the value of errno is unspecified.

https://pubs.opengroup.org/onlinepubs/007904875/functions/sigaction.html / 
https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers

> I'm not sure if Handlers[signum].func must be volatile neither.

I think your assessment here is right considering it's never used in the signal 
handler itself.

> Also, wakeup.fd is declared as sig_atomic_t on Unix. Could we use an atomic 
> variable instead, or is it important to use "sig_atomic_t"?

Again looking at the 
https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers
 recommendation it seems like using an atomic variable is fine but only if it's 
lock-free.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42767>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42660] _zoneinfo.c incorrectly checks bounds of `day` variable in calenderrule_new

2020-12-16 Thread Ammar Askar


Ammar Askar  added the comment:

> Some compilers complain about checking `day < 0`, because `day` is an 
> unsigned type

Just my two cents, this isn't just "some compilers". Everything from gcc, msvc, 
C# to the rust compiler complain about this sort of code. As they should, this 
is effectively dead code.

I think the more pragmatic way to enforce and document this assumption would be 
to have a unit test that actually checks that the constructor fails with 
"negative" days. It'll continue to fail right now as its interpretation as an 
unsigned int will be large and it will start failing if someone changes this to 
a signed type.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42660>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Ammar Askar


Ammar Askar  added the comment:

Oh whoops, got sniped by Brandt while investigating :)

--

___
Python tracker 
<https://bugs.python.org/issue42574>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42574] Travis can't build the 3.8 branch right now

2020-12-07 Thread Ammar Askar


Ammar Askar  added the comment:

>From a quick glance at 
>https://github.com/python/cpython/pulls?page=2&q=base%3A3.8+-label%3Atype-documentation

It looks like travis on 3.8 last passed at 
https://github.com/python/cpython/pull/23364 around 19 days ago

The culprit commit is likely 
https://github.com/python/cpython/commit/66dd5338a1ca98921c8e6c51228541ef8ed8076a
 from 19 days ago since it added the first bit of f-string syntax to clinic.py, 
it was committed directly without a PR which is likely why this wasn't caught.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42574>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42175] long lines from interactive stdin are truncated

2020-10-27 Thread Ammar Askar


Ammar Askar  added the comment:

This doesn't show up in piping so I think it might be a Linux terminal 
limitation. This thread claims a 4096 limit in cooked terminals, would you mind 
giving one of the work-arounds here a try and see if it that gets rid of it: 
https://unix.stackexchange.com/questions/131105/how-to-read-over-4k-input-without-new-lines-on-a-terminal

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue42175>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue38980] Compile libpython with -fno-semantic-interposition

2020-10-20 Thread Ammar Askar


Ammar Askar  added the comment:

Hey Victor, should we try to land this in Python 3.10? 

Given that no one has brought up any big concerns aside from LD_PRELOAD based 
hacks and how clang has already had this as the default I think it's relatively 
safe to make a default for with-optimizations.

--

___
Python tracker 
<https://bugs.python.org/issue38980>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42005] profile/cProfile CLI should catch BrokenPipeError

2020-10-10 Thread Ammar Askar


Ammar Askar  added the comment:

Related:

https://bugs.python.org/issue39828

--
nosy: +ammar2, vstinner

___
Python tracker 
<https://bugs.python.org/issue42005>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41972] bytes.find consistently hangs in a particular scenario

2020-10-08 Thread Ammar Askar


Ammar Askar  added the comment:

It's available from the Github gist that Kevin posted. Here is a direct link 
that you can curl/wget:

https://gist.github.com/Zeturic/7d0480a94352968c1fe92aa62e8adeaf/raw/6daebaabedaa903016810c2c04d0d1f0b1af1ed3/data.bin

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue41972>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41952] sys.version has double space between month and date

2020-10-06 Thread Ammar Askar


Ammar Askar  added the comment:

For reference, this comes from 
https://github.com/python/cpython/blob/e42b705188271da108de42b55d9344642170aa2b/Modules/getbuildinfo.c#L45-L46
and is set by the compiler `__DATE__` macro. 

GCC documentation says:

> If the day of the month is less than 10, it is padded with a space on the 
> left.

and MSVC documentation says:

> The first character of date dd is a space if the value is less than 10. This 
> macro is always defined.


So I think we can close this as working-as-intended.

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue41952>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40202] Misleading grammatically of ValueError Message?

2020-10-03 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> duplicate
stage: patch review -> resolved
status: open -> closed
superseder:  -> More descriptive error message than "too many values to unpack"

___
Python tracker 
<https://bugs.python.org/issue40202>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41902] Micro optimization for range.index if step is 1

2020-10-01 Thread Ammar Askar


Ammar Askar  added the comment:

Out of curiosity, what is the motivation for this optimization? 

Is there reason to believe that range.index is performed often enough that it's 
worth the extra code and maintenance cost here?

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue41902>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Ammar Askar


Ammar Askar  added the comment:

Whoops, forgot the numpy link: 
https://github.com/numpy/numpy/blob/33e1dbee8d9e11a3e96efaae822ff6f3c44e3cef/numpy/core/src/multiarray/number.c#L729-L741

--

___
Python tracker 
<https://bugs.python.org/issue41903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41903] PyNumber_InPlacePower ignores o3 if o1 implements __ipow__

2020-10-01 Thread Ammar Askar


Ammar Askar  added the comment:

Also of note, there is actually no way to call `PyNumber_InPlacePower` from 
pure python from what I can tell. Even libraries like numpy don't implement the 
three-argument version of the nb_inplace_power slot.

--

___
Python tracker 
<https://bugs.python.org/issue41903>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   3   4   5   >