[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



[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



[issue37862] Search doesn't find built-in functions

2019-08-21 Thread Ammar Askar


Ammar Askar  added the comment:

See also https://bugs.python.org/issue34398

There is some related work done by Julien there as well: 
https://github.com/JulienPalard/pydocsearch

--
nosy: +ammar2

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



[issue37980] regression when passing numpy bools to sorted(..., reverse=r)

2019-08-29 Thread Ammar Askar


Ammar Askar  added the comment:

Thanks for the insight Terry.

I think the functions that accept ints as bools are kind of a red herring: 
Booleans were only formally introduced in Python 2.3 [1], thus any functions 
that existed before that accepted ints and continued to accept ints for 
backwards compatibility [2]. When transition to argument clinic, these 
functions use "bool(accept={int})" which restricts the inputs to either bools 
or ints [3]. 

print, int.to_bytes and int.from_bytes all use argument clinic's bool converter 
which accepts any truth-y objects. This is similar to PyArg_ParseTuple's 'p' 
parameter which also accepts any truthy objects as well as say the print 
function which manually does a PyObject_IsTrue [4].


[1] https://www.python.org/download/releases/2.3/highlights/

[2] list.sort (sorted) existed since the start of Python: 
https://github.com/python/cpython/blob/85a5fbbdfea617f6cc8fae82c9e8c2b5c424436d/Objects/listobject.c#L423

splitlines exists in Python 2.0: 
https://github.com/python/cpython/commit/4c08d554b9009899780a5e003d6bbeb5413906ee

[3] 
https://docs.python.org/3/howto/clinic.html#using-real-argument-clinic-converters-instead-of-legacy-converters

[4] 
https://github.com/python/cpython/blob/7fcc2088a50a4ecb80e5644cd195bee209c9f979/Python/bltinmodule.c#L1888

--
nosy: +ammar2

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



[issue38057] Docs: source code don't can be translate

2019-09-08 Thread Ammar Askar


Ammar Askar  added the comment:

What version of Sphinx are you using? As far as I know, Sphinx supports 
internationalization for autodoc, so this should be possible.

--
nosy: +ammar2

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



[issue38125] Can' build document in Sphinx v2.2.0

2019-09-11 Thread Ammar Askar


Ammar Askar  added the comment:

When did you try this? For reference, Doc/conf.py on master currently has 
`master_doc = 'contents'` and I performed a successful build with Sphinx 2.2.0 
a few days ago.

--
nosy: +ammar2

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



[issue38152] AST change introduced tons of reference leaks

2019-09-14 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue38188] Incorrect Argument Order for Calls to _winapi.DuplicateHandle() in multiprocessing.reduction.DupHandle

2019-09-16 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +eryksun

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



[issue38189] pip does not run in virtual environment in 3.8

2019-09-16 Thread Ammar Askar


Ammar Askar  added the comment:

As the error says:

> Can't connect to HTTPS URL because the SSL module is not available.

Since you built it from source, you should check your build logs, the _ssl 
module likely failed to build. You're most probably missing the openssl 
dependency.

--
nosy: +ammar2

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



[issue38204] Cannot compile on RPi with optimizations

2019-09-17 Thread Ammar Askar


Ammar Askar  added the comment:

Could you provide the output of 

  gcc --version

and

  ld --version

--
nosy: +ammar2

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



[issue38206] Clarify that tp_dealloc must decref for heap allocated type

2019-09-17 Thread Ammar Askar


New submission from Ammar Askar :

When dealing with a heap allocated type 
(https://docs.python.org/3/c-api/typeobj.html#Py_TPFLAGS_HEAPTYPE / 
PyType_FromSpec), if the type has a custom tp_dealloc function then it MUST 
decrement the references to the type object itself due to this code block: 
https://github.com/python/cpython/blob/4a12a178f4a6b9a59d97fecc727f2b6b28dfc85f/Objects/typeobject.c#L1189-L1192

The only mention of this is within the whatsnew entry for 3.8: 
https://github.com/python/cpython/commit/364f0b0f19cc3f0d5e63f571ec9163cf41c62958#diff-77c703d9a958f6a4b0dc2f692b3fd5b3

This error was made in 
https://github.com/python/cpython/pull/16127#pullrequestreview-288312751 and 
https://github.com/python/cpython/pull/16071#pullrequestreview-287819525

It seems like a common pitfall, let's add a note about this in the doc.

--
assignee: docs@python
components: Documentation
messages: 352672
nosy: ammar2, docs@python
priority: normal
severity: normal
status: open
title: Clarify that tp_dealloc must decref for heap allocated type
type: enhancement
versions: Python 3.9

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



[issue38206] Clarify that tp_dealloc must decref for heap allocated type

2019-09-17 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue38204] Cannot compile on RPi with optimizations

2019-09-18 Thread Ammar Askar


Ammar Askar  added the comment:

Hmm, I think this might be the following gcc/binutils bug: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84847
https://sourceware.org/bugzilla/show_bug.cgi?id=20882

This might be a bit of a pain but could you try updating binutils and see if 
the problem persists.

--

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



[issue38205] Python no longer compiles without small integer singletons

2019-09-18 Thread Ammar Askar


Ammar Askar  added the comment:

For the control path warning, that can be fixed by just hinting to the compiler 
that the function doesn't return like so:

  # ifdef __GNUC__
  __attribute__ ((noreturn))
  # elif defined(_MSC_VER)
  __declspec(noreturn)
  # endif
  static inline void
  _Py_UNREACHABLE()
  {


(https://godbolt.org/z/AG9tx_)

--
nosy: +ammar2

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



[issue38216] Fix for issue30458 prevents crafting invalid requests

2019-09-19 Thread Ammar Askar


Ammar Askar  added the comment:

> What bothers me here is that we apparently changed de facto behavior between 
> maintenance releases, in the middle of 3.7's lifecycle, without warning, no 
> doubt because we didn't realize it would break third-party packages.

Arguably, I think the programs that are affected by this vulnerability far 
outnumber the amount of third-party packages that will be broken. The trade-off 
here seems to be between the promise of compatibility and the promise of 
security, choosing compatibility strikes me as odd.

--
nosy: +ammar2

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



[issue38233] datetime.datetime.fromtimestamp have different behaviour on windows and mac

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Thanks for the report Alexandre, this has to do with issues with negative 
numbers in Window's time APIs. There's already a bug open for this, so I've 
marked it as a duplicate.

--
nosy: +ammar2
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Timestamp conversion on windows fails with timestamps close to 
EPOCH
type: crash -> behavior

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



[issue38231] Documentation search results focus on tutorials and not language specifications

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

This is a great point Matt, the documentation search is a bit lacking and we're 
kind of using https://bugs.python.org/issue34398 and 
https://github.com/python/cpython/pull/8773 to track it.

The current idea that Julien, the docs expert, had is to add some sort of 
Sphinx directive in the docs that boosts and entry's search result. Would you 
like to close this issue in favor of that one...or post your comment there so 
we can track these in one place?

--
nosy: +ammar2

___
Python tracker 
<https://bugs.python.org/issue38231>
___
___
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

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Changing the title a little to represent that this is now a general improvement 
of the docs search. Julien is working to upstream a solution into Sphinx that 
will allow any items to be featured prominently on search.

--
title: Docs search does not index glossary items -> Docs search should 
prominently show definitions and glossary items

___
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



[issue38231] Documentation search results focus on tutorials and not language specifications

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

> Somewhat related, I am responding to this through the bugs.python.org 
> interface.  If I reply directly to the email the tracker sent me, will my 
> reply be properly routed to this thread? 

Yes, it will :)

The bug tracker allows replies by email.

--

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Looks like a solid proposal, I especially like the clarity for the 3-argument 
call. Often beginners ask about why there's a third argument in pow especially 
when teaching RSA and number-theoretic stuff.

Do you mind if I take this on Raymond?

--
nosy: +ammar2

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Actually quick question, should a similar change be made for `math.pow` for 
consistency's sake?

--

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

I've made a PR, feel free to close it if you'd rather implement this yourself 
or this proposal won't be accepted :)

--

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Here's a little microbenchmark, let me know if there's anything specific you'd 
like to see:

Before
==

> python -m pyperf timeit "from test.test_builtin import BuiltinTest; tst = 
> BuiltinTest()" -- "tst.test_pow()"

Mean +- std dev: 3.80 us +- 0.23 us

> python -m pyperf timeit "pow(23, 19, 3)"

Mean +- std dev: 519 ns +- 12 ns


After
=

> python -m pyperf timeit "from test.test_builtin import BuiltinTest; tst = 
> BuiltinTest()" -- "tst.test_pow()"

Mean +- std dev: 3.80 us +- 0.26 us

> python -m pyperf timeit "pow(23, 19, 3)"

Mean +- std dev: 526 ns +- 18 ns

--

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Before
==

>python -m pyperf timeit "pow(2, 3)" --duplicate 10
Mean +- std dev: 242 ns +- 19 ns

> python -m pyperf timeit "pow(2.0, 3.0)" --duplicate 10
Mean +- std dev: 197 ns +- 16 ns

After
=

> python -m pyperf timeit "pow(2, 3)" --duplicate 10
Mean +- std dev: 243 ns +- 11 ns

> python -m pyperf timeit "pow(2.0, 3.0)" --duplicate 10
Mean +- std dev: 200 ns +- 14 ns

--

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



[issue38237] Expose meaningful keyword arguments for pow()

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

math.pow changes removed from PR

--

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



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2019-09-20 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> duplicate
stage:  -> resolved
superseder:  -> unittest.TestCase.assertCountEqual is a very misleading name
type:  -> behavior

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



[issue38240] assertCountEqual is horribly misleading, sounds like only counts are being compared

2019-09-20 Thread Ammar Askar


Ammar Askar  added the comment:

Hey Vitaly, not sure if you're the author of the original bug here: 
https://bugs.python.org/issue27071

Could you re-open that so the discussion is kept in one place.

--
nosy: +ammar2

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



[issue38231] Documentation search results focus on tutorials and not language specifications

2019-09-20 Thread Ammar Askar


Change by Ammar Askar :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Docs search should prominently show definitions and glossary 
items

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



[issue38245] Why am I getting inconsistent results in this simple List assignment?

2019-09-21 Thread Ammar Askar


Ammar Askar  added the comment:

Check out this part of the FAQ: 
https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list

Essentially, when you did `C = 2*[[]]`, what happens is that the SAME empty 
list is placed into C[0] and C[1]. Whereas when you do `M = [[],[]]`, you're 
creating two different lists. You can confirm this using:

>>> C = 2*[[]]
>>> C[0] is C[1]
True
>>> M = [[],[]]
>>> M[0] is M[1]
False

--
nosy: +ammar2
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue38247] list(str.split(ch)) Does not print blank elements upon repeating character(ch)

2019-09-21 Thread Ammar Askar


Ammar Askar  added the comment:

For whitespace, the correct way to achieve this using split() with no argument:

>>> print(list("Hello World How Are You?".split()))
['Hello', 'World', 'How', 'Are', 'You?']
>>> print(list("Hello World   How Are  You?".split()))
['Hello', 'World', 'How', 'Are', 'You?']

Your proposed solution would be a breaking change to all code that relies on 
the old style.

--
nosy: +ammar2

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



[issue38206] Clarify that tp_dealloc must decref for heap allocated type

2019-09-27 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue38300] Documentation says destuction of TemporaryDirectory object will also delete it, but it does not.

2019-09-27 Thread Ammar Askar


Ammar Askar  added the comment:

Hmm, I can't recreate this locally:

>>> import tempfile
>>> import os
>>> t = tempfile.TemporaryDirectory()
>>> temp_dir = t.name
>>> os.path.exists(temp_dir)
True
>>> del t
>>> os.path.exists(temp_dir)
False

What version of Python are you using?

--
nosy: +ammar2

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



[issue38312] curses: add `set_tabsize` and `set_escdelay`

2019-09-28 Thread Ammar Askar


Ammar Askar  added the comment:

> I'd like to help with this, but I don't even know where to start with 
> argumentclinic -- any points would be greatly appreciated

Are you asking about argumentclinic in general or something specific to this 
bug? If it's something specific feel free to ignore the following:

You can find a basic tutorial on argumentclinic here 
https://docs.python.org/3/howto/clinic.html#basic-concepts-and-usage

Essentially, you'll be adding something along these lines into _cursesmodule.c

/*[clinic input]
_curses.set_escdelay
size: int
bla bla description for size.
/

One line description.

Extended description. Spanning over
multiple lines.
[clinic start generated code]*/

after which you can run `python3 Tools/clinic/clinic.py _cursesmodule.c` which 
will update the file and place the stub for the method in there.

--
nosy: +ammar2

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



[issue38302] __rpow__ not reached when __ipow__ returns NotImplemented

2019-09-29 Thread Ammar Askar


Ammar Askar  added the comment:

This isn't the ternary form of pow(), the documentation there is referring to 
the `pow(base, exp, modulus)`.

--
nosy: +ammar2

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



[issue38316] docs: Code object's "co_stacksize" field is described with mistake

2019-09-29 Thread Ammar Askar


Ammar Askar  added the comment:

Yeah, that parenthesized bit seems a bit weird: co_stacksize really has nothing 
to do with the number of variables, it's just that certain opcodes 
(https://docs.python.org/3/library/dis.html#python-bytecode-instructions) push 
and pop off the stack, co_stacksize is just the largest the stack will ever 
grow to from these operations.

For example:

  >>> def f():
  ...   a = 1
  ...   b = 2
  ...   c = 3
  ...   g(a, b, c)
  ...
  >>> f.__code__.co_stacksize
  4

and

  >>> def g():
  ...   g(1, 2, 3)
  ...
  >>> g.__code__.co_stacksize
  4

have the exact same stack size despite differences in variables because the 
call to `g` has to push all 3 operands (and g itself) onto the stack.

--
nosy: +ammar2

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



[issue38318] Issues linking with ncurses and tinfo (cannot resolve symbols)

2019-09-29 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +skrah, twouters

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



[issue38327] Creating set with empty string returns empty set

2019-09-30 Thread Ammar Askar


Ammar Askar  added the comment:

I think the key thing you're missing here is that the set() constructor can 
take any arbitrary iterable 
(https://docs.python.org/3/library/functions.html#func-set). It simply goes 
over all the elements inside and adds them all to the set. This is no different 
than the following for example:

>>> for char in 'somestring': 
...   print(char) 
...   
s 
o 
m 
e 
s 
t 
r 
i 
n 
g 
>>>
>>> for char in '':
...   print(char)
...
>>>

When you iterate over a string, it simply goes over each character inside it.

> While set('somestring') gives me a set of size one

This should not be the case, set('something') should be giving you a set of 
size 9. Each element in the set being a character from the string 'somestring'

>>> set('somestring')
{'t', 's', 'e', 'n', 'g', 'o', 'r', 'i', 'm'}
>>> len(set('somestring'))
9

> set('') gives me an empty set (of size zero)

Now hopefully it should be obvious why this happens, the set() constructor goes 
over each character in the string. Which in this case, there aren't any because 
the string is completely empty. This leads to an empty set. This is no 
different than doing set([])

--
nosy: +ammar2
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue38357] print adding extra bytes in hex above x7F

2019-10-02 Thread Ammar Askar


Ammar Askar  added the comment:

If you're trying to get raw bytes, you need to use

print(b'\x80')

what's happening right now is that the '\x80' is treated as a unicode code 
point (see https://docs.python.org/3/howto/unicode.html#the-string-type), and 
when Python goes to print it, it gets encoded to the raw underlying bytes. 
Which, in the default encoding of utf-8 requires the extra byte.

>>> '\x80'.encode()
b'\xc2\x80'

--
nosy: +ammar2
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue17894] Edits to descriptor howto

2019-10-09 Thread Ammar Askar


Ammar Askar  added the comment:

Any updates on this? Some of the re-organization and simplifications here look 
pretty good overall and make the guide way more approachable.

Seeing as how this has been sitting a while and Github has an option allow 
maintainers to make edits to PRs. Raymond, would you be fine with Ned making a 
PR out of these changes to solicit your feedback and incorporate it the way you 
want?

--
nosy: +ammar2

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



[issue20443] __code__. co_filename should always be an absolute path

2019-10-21 Thread Ammar Askar


Ammar Askar  added the comment:

I did a quick search to see what code would break from sys.argv[0] going 
relative

  intext:"sys.argv[0]" ext:py site:github.com
  
https://www.google.com/search?q=intext:"sys.argv%5B0%5D"+ext:py+site:github.com

and while most uses of it are to print usage messages. There is potentially 
code relying on it being a relative path that will break from this change:

* 
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/flagvalues.py#L868-L869
* 
https://github.com/HcashOrg/hcOmniEngine/blob/f1acc2ba3640a8e1c651ddc90a86d569d00704fe/msc-cli.py#L12
* 
https://github.com/vmtk/vmtk/blob/64675f598e31bc6be3d4fba903fb59bf1394f492/PypeS/pyperun.py#L35
* 
https://github.com/apache/lucene-solr/blob/cfa49401671b5f9958d46c04120df8c7e3f358be/dev-tools/scripts/svnBranchToGit.py#L783

I think Michel and Nick are correct here and the status-quo should be 
maintained for sys.argv[0]. Michel should not have to enumerate the use cases 
for a relative sys.argv[0].

--
nosy: +ammar2

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



[issue38558] Data Structures documentation out of sync with new Walrus operator

2019-10-24 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue38558] Data Structures documentation out of sync with new Walrus operator

2019-10-25 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you for the report Matt!

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

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



[issue38656] mimetypes for python 3.7.5 fails to detect matroska video

2019-10-31 Thread Ammar Askar


Ammar Askar  added the comment:

This is what I get on master, will try 3.7.5+ as noted in the Github issue:


Python 3.9.0a0 (heads/noopt-dirty:f3b170812d, Oct  1 2019, 20:15:53) [MSC 
v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mimetypes
>>> print(mimetypes.guess_type('E01.mkv'))
('video/x-matroska', None)

--
nosy: +ammar2

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



[issue38645] datetime.datetime.fromtimestamp(0, tzlocal()) throws error

2019-10-31 Thread Ammar Askar


Ammar Askar  added the comment:

Err...I mean I think this is a dateutil bug rather than in the Python stdlib.

--

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



[issue38645] datetime.datetime.fromtimestamp(0, tzlocal()) throws error

2019-10-31 Thread Ammar Askar


Ammar Askar  added the comment:

It is windows specific, but I don't think this is a dateutil bug rather than 
the python stdlib:

Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> from dateutil.tz import tzlocal
>>> print(datetime.datetime.fromtimestamp(0, tzlocal()))
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Python365\lib\site-packages\dateutil\tz\_common.py", line 144, in 
fromutc
return f(self, dt)
  File "D:\Python365\lib\site-packages\dateutil\tz\_common.py", line 258, in 
fromutc
dt_wall = self._fromutc(dt)
  File "D:\Python365\lib\site-packages\dateutil\tz\_common.py", line 238, in 
_fromutc
dtdst = enfold(dt, fold=1).dst()
  File "D:\Python365\lib\site-packages\dateutil\tz\tz.py", line 225, in dst
if self._isdst(dt):
  File "D:\Python365\lib\site-packages\dateutil\tz\tz.py", line 288, in _isdst
if self.is_ambiguous(dt):
  File "D:\Python365\lib\site-packages\dateutil\tz\tz.py", line 250, in 
is_ambiguous
(naive_dst != self._naive_is_dst(dt - self._dst_saved)))
  File "D:\Python365\lib\site-packages\dateutil\tz\tz.py", line 254, in 
_naive_is_dst
return time.localtime(timestamp + time.timezone).tm_isdst
OSError: [Errno 22] Invalid argument


As you can see, none of that backtrace is within Python, it's all inside 
dateutil code. More than likely they are calling `time.localtime` with a value 
of less than 0 which throws an error on Windows. (see also issue29097)

--
nosy: +ammar2

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



[issue38645] datetime.datetime.fromtimestamp(0, tzlocal()) throws error

2019-10-31 Thread Ammar Askar


Ammar Askar  added the comment:

Closing, here's the bug in dateutil's repo: 
https://github.com/dateutil/dateutil/issues/197

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed

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



[issue38660] Checking if two regexes are equal should test if they are functionally equivalent

2019-11-01 Thread Ammar Askar


Ammar Askar  added the comment:

The notion of equivalent regular expressions does exist but is way more 
complicated than the simple example you described.

For example:

r"a|b" is the same as r"[ab]",
r"^aa*$" is the same as r"^a+$"

Implementing this properly would probably require a significant amount of 
effort, and just implementing simple equivalence for character classes would be 
really surprising.

Could you explain the use case and motivation behind this request?

--
nosy: +ammar2

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



[issue38655] ipaddress.ip_network('0.0.0.0/0').is_private == True

2019-11-04 Thread Ammar Askar


Ammar Askar  added the comment:

The documentation for is_private notes:

  Returns:
  A boolean, True if the address is reserved per RFC 4193.
  iana-ipv4-special-registry or iana-ipv6-special-registry.

If we take a look at the iana-ipv4-special-registry then 0.0.0.0/8 does show up 
there: 
https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml

While the name might be a misnomer, is_reserved instead of is_private might 
have been better, it does seem to conform to what the documentation says it 
will do.

--
nosy: +ammar2

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



[issue38655] ipaddress.ip_network('0.0.0.0/0').is_private == True

2019-11-04 Thread Ammar Askar


Ammar Askar  added the comment:

Aah actually I was looking at an older version of the docs, the documentation 
now says, "if the address is allocated for private networks" which is actually 
misleading. The addresses here aren't all private networks: 
https://github.com/python/cpython/blob/25fa3ecb98f2c038a422b19c53641fa8e3ef8e52/Lib/ipaddress.py#L1537-L1553

--

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



[issue38699] socket: change listen() default backlog from 128 to 4096?

2019-11-05 Thread Ammar Askar


Ammar Askar  added the comment:

Just for some more reference points from "production" python web servers:

* gunicorn - 2048 
(https://github.com/benoitc/gunicorn/blob/678b326dc030b450717ec505df69863dcd6fb716/docs/source/settings.rst#backlog)

* tornado - 128 
(https://github.com/tornadoweb/tornado/blob/c50aed0f96d92f9b0ef4cd0837c0104f140ca77e/tornado/tcpserver.py#L178)

* uwsgi - 100 
(https://github.com/unbit/uwsgi/blob/3149df02ed443131c54ea6afb29fcbb0ed4d1139/core/init.c#L115)

--
nosy: +ammar2

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



[issue16575] ctypes: unions as arguments

2019-11-05 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue16575] ctypes: unions as arguments

2019-11-05 Thread Ammar Askar

Ammar Askar  added the comment:

Opened https://github.com/python/cpython/pull/17064 to fix this. Essentially 
it's a tiny little oversight in the back-porting. In the 3.7 branch, we perform 
an attribute lookup for `from_param` before the union checking code, so we must 
remember to DECREF it. This is unlike master where the attribute lookup happens 
after the union checking code.



λ win32\python_d.exe -m test -R 3:3 test_ctypes
0:00:00 Run tests sequentially
0:00:00 [1/1] test_ctypes
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 14.8 sec
Tests result: SUCCESS

--
nosy: +ammar2

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



[issue38696] HTTP modules documentation error

2019-11-05 Thread Ammar Askar


Change by Ammar Askar :


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

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-05 Thread Ammar Askar


Ammar Askar  added the comment:

I like Steven's "truthy value" or "true value" proposal. Another alternative:

"x does not evaluate to true"
"x does not evaluate to false"

--
nosy: +ammar2

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



[issue38706] What should the error message in the exception raised by assertTrue and assertFalse be?

2019-11-06 Thread Ammar Askar


Ammar Askar  added the comment:

I don't think the word "true" is really the issue here. It's the fact that "is" 
in this context is ambiguous, is it referring to the English "is" or the python 
operator `is`?

--

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



[issue16575] ctypes: unions as arguments

2019-11-06 Thread Ammar Askar


Ammar Askar  added the comment:

Will close after 
https://buildbot.python.org/all/#/builders?tags=%2Brefleak&tags=%2B3.7 go back 
to green.

--

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



[issue38724] Implement subprocess.Popen.__repr__

2019-11-06 Thread Ammar Askar


Change by Ammar Askar :


--
nosy: +gregory.p.smith

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



[issue16575] ctypes: unions as arguments

2019-11-06 Thread Ammar Askar


Change by Ammar Askar :


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

___
Python tracker 
<https://bugs.python.org/issue16575>
___
___
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



[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


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: +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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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-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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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



[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-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



[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



[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



[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



[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



[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:

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:

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-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



[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



[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



[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



  1   2   3   4   5   >