[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread Alex Waygood

Alex Waygood  added the comment:

Thanks so much to Ken, Łukasz, Jelle, Guido, and everybody else who helped 
review these PRs!

--

___
Python tracker 

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



[issue46953] use FASTCALL for __import__ builtin

2022-03-07 Thread Kumar Aditya


New submission from Kumar Aditya :

Use FASTCALL for __import__ builtin.

Benchmark:
--
import pyperf

runner = pyperf.Runner()
runner.timeit(name="bench __import__",
  stmt="__import__('asyncio')"


Result:

Mean +- std dev: [base] 191 ns +- 16 ns -> [patch] 112 ns +- 11 ns: 1.71x faster

--
components: Interpreter Core
messages: 414729
nosy: Dennis Sweeney, Mark.Shannon, kumaraditya303
priority: normal
pull_requests: 29865
severity: normal
status: open
title: use FASTCALL for __import__ builtin
type: performance
versions: Python 3.11

___
Python tracker 

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



[issue43574] Regression in overallocation for literal list initialization in v3.9+

2022-03-07 Thread Inada Naoki


Inada Naoki  added the comment:

Relating issue: https://twitter.com/nedbat/status/1489233208713437190
Current overallocation strategy is rough. We need to make it more smooth.

--
versions: +Python 3.11 -Python 3.9

___
Python tracker 

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



[issue43574] Regression in overallocation for literal list initialization in v3.9+

2022-03-07 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane

___
Python tracker 

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



[issue39829] __len__ called twice in the list() constructor

2022-03-07 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane

___
Python tracker 

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



[issue39829] __len__ called twice in the list() constructor

2022-03-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Related to Matt's idea is https://bugs.python.org/issue43574

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46952] pip progress bar display bug

2022-03-07 Thread Dennis Sweeney


Change by Dennis Sweeney :


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

___
Python tracker 

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



[issue46952] pip progress bar display bug

2022-03-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

pip is maintained externally at https://github.com/pypa/pip , so that is likely 
a better place to open an issue about pip.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue46952] pip progress bar display bug

2022-03-07 Thread 미사일

Change by 미사일 :


Added file: https://bugs.python.org/file50663/screen.jpg

___
Python tracker 

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



[issue46952] pip progress bar display bug

2022-03-07 Thread 미사일

Change by 미사일 :


--
components:  -2to3 (2.x to 3.x conversion tool)

___
Python tracker 

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



[issue46952] pip progress bar display bug

2022-03-07 Thread 미사일

New submission from 미사일 :

Pip progress bar isn't connect each other and overlap with other components.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 414725
nosy: misileminecord
priority: normal
severity: normal
status: open
title: pip progress bar display bug
versions: Python 3.8

___
Python tracker 

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



[issue2771] Test issue

2022-03-07 Thread Ezio Melotti


Change by Ezio Melotti :


--
dependencies: +Add math.tau, Python source code build fails with old mercurial
superseder:  -> Test issue

___
Python tracker 

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



[issue39829] __len__ called twice in the list() constructor

2022-03-07 Thread Matt Wozniski


Matt Wozniski  added the comment:

Pardon me for necroing an old issue, but someone pointed out the surprising 
behavior of `__len__` being called twice by `list(iterable)`, and it caught my 
curiosity.

https://github.com/python/cpython/commit/372d705d958964289d762953d0a61622755f5386
 made it so that `list.__init__(iterable)` calls `iterable.__len__()` before 
calling `list.extend()`, to preallocate exactly the right amount of space, 
rather than allowing `list.extend()` to grow the array. That's because 
`list.extend()` can over-allocate.

What if instead, we made it so that `list.extend(iterable)` doesn't 
over-allocate when called on an empty list? In the two places where 
`list_extend` calls `list_resize` to grow the array, we'd check if 
`self->ob_item == NULL` and if so call `list_preallocate_exact` instead, and 
we'd remove the call to `list_preallocate_exact` from `list___init___impl`.

It seems like that ought to achieve the same goal as making `__init__` call 
preallocate exactly, without requiring the extra call to `__len__`.

--
nosy: +godlygeek

___
Python tracker 

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



[issue46951] Zipapp contents are in filesystem-dependent order

2022-03-07 Thread Henry Finucane


New submission from Henry Finucane :

Which makes builds non-reproducible. There was some mention of fixing this in 
https://bugs.python.org/issue30693, but it never got done.

--
components: Library (Lib)
messages: 414723
nosy: h.finucane
priority: normal
pull_requests: 29864
severity: normal
status: open
title: Zipapp contents are in filesystem-dependent order
type: enhancement
versions: Python 3.10, Python 3.11, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset 0c718e02f60f98275c62e8a2a152f086650e88ea by Miss Islington (bot) 
in branch '3.9':
bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260)
https://github.com/python/cpython/commit/0c718e02f60f98275c62e8a2a152f086650e88ea


--

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset e053f0e9f41791095a924e2aceaaa025a058ed57 by Miss Islington (bot) 
in branch '3.10':
bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260)
https://github.com/python/cpython/commit/e053f0e9f41791095a924e2aceaaa025a058ed57


--

___
Python tracker 

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



[issue46878] [sqlite3] remove "non-standard" from docstrings

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 4d95fa1ac5d31ff450fb2f31b55ce1eb99d6efcb by Erlend Egeberg 
Aasland in branch 'main':
bpo-46878: Purge 'non-standard' from sqlite3 docstrings (GH-31612)
https://github.com/python/cpython/commit/4d95fa1ac5d31ff450fb2f31b55ce1eb99d6efcb


--

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset e83f084084296a9b16b83b324a715045d3614c92 by Miss Islington (bot) 
in branch '3.9':
bpo-45680: Improve docs on subscriptions w.r.t. `GenericAlias` objects 
(GH-29479)
https://github.com/python/cpython/commit/e83f084084296a9b16b83b324a715045d3614c92


--

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset 06108c08ddbb4efda804eb74dd33928348102e6f by Miss Islington (bot) 
in branch '3.10':
bpo-45680: Improve docs on subscriptions w.r.t. `GenericAlias` objects 
(GH-29479)
https://github.com/python/cpython/commit/06108c08ddbb4efda804eb74dd33928348102e6f


--

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-03-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29863
pull_request: https://github.com/python/cpython/pull/31747

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-03-07 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 7.0 -> 8.0
pull_requests: +29862
pull_request: https://github.com/python/cpython/pull/31746

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

Thanks for the patch!

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

___
Python tracker 

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



[issue46494] Mention typing_extensions in the typing documentation

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 8debeed3075bf4d7e568e65da16bec63cf276f4f by Meer Suri in branch 
'main':
bpo-46494: Mention the typing_extensions pkg in typing docs (GH-31260)
https://github.com/python/cpython/commit/8debeed3075bf4d7e568e65da16bec63cf276f4f


--

___
Python tracker 

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



[issue43224] Add support for PEP 646

2022-03-07 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :


New changeset 7a793a388b017be635ea41ef75b0fd8bcf75a309 by Matthew Rahtz in 
branch 'main':
bpo-43224: Implement PEP 646 changes to typing.py (GH-31021)
https://github.com/python/cpython/commit/7a793a388b017be635ea41ef75b0fd8bcf75a309


--

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

And now I think we're really done! Thanks for all your work here @AlexWaygood.

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

___
Python tracker 

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



[issue46170] Improving the error message when subclassing NewType

2022-03-07 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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

___
Python tracker 

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



[issue46170] Improving the error message when subclassing NewType

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset f391f9bf28f0bba7939d9f9e5a7a6396d2b0df62 by James Hilton-Balfe in 
branch 'main':
bpo-46170: Improve the error message when subclassing NewType (GH-30268)
https://github.com/python/cpython/commit/f391f9bf28f0bba7939d9f9e5a7a6396d2b0df62


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:


New changeset 50731297a9b6d57eec3b3f89522785b23f7b3e71 by Alex Waygood in 
branch 'main':
bpo-45680: Improve docs on subscriptions w.r.t. `GenericAlias` objects 
(GH-29479)
https://github.com/python/cpython/commit/50731297a9b6d57eec3b3f89522785b23f7b3e71


--
nosy: +Jelle Zijlstra

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29861
pull_request: https://github.com/python/cpython/pull/31744

___
Python tracker 

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



[issue45680] Documentation on `GenericAlias` objects and `__class_getitem__` could be improved

2022-03-07 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Is there anything on our end we can do to prevent this kind of issue in the 
future?

Am I wrong to see this as just fixing our package to avoid a design flaw in 
Windows OS level package management?

Certainly other packages in the world must run into similar problems.

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue46947] unicodedata.name gives ValueError for control characters

2022-03-07 Thread Joe Cool

Joe Cool  added the comment:

My recommendation would be to add a keyword parameter, defaulting to False, to 
name(), something like give_full_alias, or maybe errors=“give_full_alias” like 
the IO functions.

In the meantime, as the author of perllib, I had to make my own dict to return 
to the user the same thing perl does, which is the full alias for these.

--

___
Python tracker 

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-07 Thread Guido van Rossum


Guido van Rossum  added the comment:

Playing tricks where compile-time and run-time see slightly different types is 
probably more productive than trying to revert a PR that was in Python 3.9 and 
3.10. :-)

I'm not opposed to supporting generic NamedTuple, but I expect the fix will 
never hit 3.9 and 3.10, and it needs to be a "fix forward" PR.

Would you mind closing the "revert" PR unmerged?

--

___
Python tracker 

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



[issue46841] Inline bytecode caches

2022-03-07 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +29859
pull_request: https://github.com/python/cpython/pull/31742

___
Python tracker 

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



[Python-announce] NumPy 1.22.3 released

2022-03-07 Thread Charles R Harris
Hi All,

On behalf of the NumPy team, I'm pleased to announce the release of NumPy
1.22.3. NumPy 1.22.3 is a maintenance release that fixes bugs discovered
after the 1.22.2 release. The most noticeable fixes may be those for
DLPack. One that may cause some problems is disallowing strings as inputs
to logical ufuncs. It is still undecided how strings should be treated in
those functions and it was thought best to simply disallow them until a
decision was reached. That should not cause problems with older code.

The Python versions supported in this release are 3.8-3.10.  Wheels can be
downloaded from PyPI ; source
archives, release notes, and wheel hashes are available on Github
. Note that the Mac
wheels are now based on OS X 10.14 rather than 10.9 that was used in
previous NumPy release cycles. 10.14 is the oldest release supported by
Apple. Linux users will need pip >= 0.19.3 in order to install the
manylinux2014 wheels. A recent version of pip is needed to install the
universal2 macos wheels.

*Contributors*

A total of 9 people contributed to this release.  People with a "+" by
their names contributed a patch for the first time.


   - @GalaxySnail +
   - Alexandre de Siqueira
   - Bas van Beek
   - Charles Harris
   - Melissa Weber Mendonça
   - Ross Barnowski
   - Sebastian Berg
   - Tirth Patel
   - Matthieu Darbois


*Pull requests merged*

A total of 10 pull requests were merged for this release.


   - #21048: MAINT: Use "3.10" instead of "3.10-dev" on travis.
   - #21106: TYP,MAINT: Explicitly allow sequences of array-likes in
   ``np.concatenate``
   - #21137: BLD,DOC: skip broken ipython 8.1.0
   - #21138: BUG, ENH: np._from_dlpack: export correct device information
   - #21139: BUG: Fix numba DUFuncs added loops getting picked up
   - #21140: BUG: Fix unpickling an empty ndarray with a non-zero
   dimension...
   - #21141: BUG: use ThreadPoolExecutor instead of ThreadPool
   - #21142: API: Disallow strings in logical ufuncs
   - #21143: MAINT, DOC: Fix SciPy intersphinx link
   - #21148: BUG,ENH: np._from_dlpack: export arrays with any strided
   size-1...

Cheers,

Charles Harris
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue46947] unicodedata.name gives ValueError for control characters

2022-03-07 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

The behaviour is technically correct, but confusing and unfortunate, and I 
don't think we can fix it.

Unicode does not define names for the ASCII control characters. But it does 
define aliases for them, based on the C0 control char standard.

unicodedata.lookup() looks for aliases as well as names (since version 3.3).

https://www.unicode.org/Public/UNIDATA/UnicodeData.txt
https://www.unicode.org/Public/UNIDATA/NameAliases.txt

It is unfortunate that we have only a single function for looking up a unicode 
code point by name, alias, alias-abbreviation, and named-sequence. That keeps 
the API simple, but in corner cases like this it leads to confusion.

The obvious "fix" is to make name() return the alias if there is no official 
name to return, but that is a change in behaviour. I have code that assumes 
that C0 and C1 control characters have no name, and relies on name() raising an 
exception for them.

Even if we changed the behaviour to return the alias, which alias should be 
returned, the full alias or the abbreviation?

This doesn't fix the problem that name() and lookup() aren't inverses of each 
other:

lookup('NUL') -> '\0  # using the abbreviated alias
name('\0') -> 'NULL'  # returns the full alias (or vice versa)

It gets worse with named sequences:

>>> c = lookup('LATIN CAPITAL LETTER A WITH MACRON AND GRAVE')
>>> name(c)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: name() argument 1 must be a unicode character, not str
>>> len(c)
2

So we cannot possibly make name() and lookup() inverses of each other.

What we really should have had is separate functions for name and alias 
lookups, or better still, to expose the raw unicode tables as mappings and let 
people create their own higher-level interfaces.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread Ned Deily


Ned Deily  added the comment:


New changeset f656bc1cdbdfaaa07f66ed97e011b258b97e2788 by Miss Islington (bot) 
in branch '3.7':
bpo-46932: Update bundled libexpat to 2.4.7 (GH-31736) (GH-31741)
https://github.com/python/cpython/commit/f656bc1cdbdfaaa07f66ed97e011b258b97e2788


--

___
Python tracker 

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



[issue45806] Cannot Recover From StackOverflow in 3.9 Tests

2022-03-07 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Should this be backported to make the 3.8 Buildbots happy?

--

___
Python tracker 

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



[issue43923] Can't create generic NamedTuple as of py3.9

2022-03-07 Thread Steven Silvester


Steven Silvester  added the comment:

The use case that prompted https://github.com/python/cpython/pull/31679 is that 
we are adding typings to `PyMongo`.  We are late to using typings,  because we 
only recently dropped Python 2.7 support.  

We have an existing options class that subclasses `NamedTuple`.  We would like 
to make that class `Generic`, but are currently blocked.  

Our current workaround is to create a separate stub file that uses `class 
CodecOptions(Tuple, Generic[T])` and explicitly re-declares the `NamedTuple` 
API.

Switching to `dataclass` would be disruptive, since we still support Python 3.6 
and only rely on the standard library.  We would also require a major version 
update since it would be an API change.

--
nosy: +Steven Silvester

___
Python tracker 

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



[issue46933] Make pwd module optional for wasm32-emscripten and wasi

2022-03-07 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 47cca0492b3c379823d4bdb600be56a633e5bb88 by Erlend Egeberg 
Aasland in branch 'main':
bpo-46933: Fix make distclean regression (GH-31737)
https://github.com/python/cpython/commit/47cca0492b3c379823d4bdb600be56a633e5bb88


--

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset f46a04469114047ff7a4078619450c590ae3f287 by Miss Islington (bot) 
in branch '3.9':
bpo-46932: Update bundled libexpat to 2.4.7 (GH-31736)
https://github.com/python/cpython/commit/f46a04469114047ff7a4078619450c590ae3f287


--

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread miss-islington


miss-islington  added the comment:


New changeset 1e52e782f9742242923dec43c2bf8c1455a531e7 by Miss Islington (bot) 
in branch '3.10':
bpo-46932: Update bundled libexpat to 2.4.7 (GH-31736)
https://github.com/python/cpython/commit/1e52e782f9742242923dec43c2bf8c1455a531e7


--

___
Python tracker 

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



[issue46890] venv does not create "python" link in python 3.11

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:

> This could be problematic, adding a suitably named file outside of $PREFIX 
> breaks the python installation.

Might be worth changing it then. I double/triple checked whether 
searching up for the zip file was the old behaviour, and it sure seemed 
to be (it wasn't on Windows). Will only be a little tweak to change, 
since both codepaths are already there.

My assumption was that any higher-level directories in that tree would 
be at least as restricted as where Python is installed, so anyone who 
could hijack it there could also have modified it closer to the actual file.

--

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29858
pull_request: https://github.com/python/cpython/pull/31741

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29857
pull_request: https://github.com/python/cpython/pull/31740

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +29856
pull_request: https://github.com/python/cpython/pull/31739

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +29855
pull_request: https://github.com/python/cpython/pull/31738

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset 176835c3d5c70f4c1b152cc2062b549144e37094 by Steve Dower in branch 
'main':
bpo-46932: Update bundled libexpat to 2.4.7 (GH-31736)
https://github.com/python/cpython/commit/176835c3d5c70f4c1b152cc2062b549144e37094


--

___
Python tracker 

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



[issue46890] venv does not create "python" link in python 3.11

2022-03-07 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

WITH_NEXT_FRAMEWORK is a compile time option, I've added it to globals in 
values like PREFIX are added. That way the python code can behave differently 
for framework builds (which appears to be needed).

There are two big problems with my patches:
- Calculation of sys.prefix doesn't work in test_venv_framework_macos, but 
somehow works with a real installation. I haven't managed to track down the 
difference yet.
- Calculation for test_framework_macos appears to be ok on first glance, but 
adding "/Library/lib/python9.8.zip" as a known file shows that the code to look 
for the stdlib is misbehaving.

The latter appears to be a wider problem, if I add a test case based on 
test_normal_posix with PREFIX=/opt/python9.8 the getpath code looks for 
/opt/lib/python98.zip and uses that when found.

Test case for this (test passed when 
``ns.add_known_file("/opt/lib/python98.zip")`` is commented out:

def test_normal_posix_in_opt(self):
  """Test a 'standard' install layout on *nix
  
  This uses '/opt/python9.8' as PREFIX
  """
  ns = MockPosixNamespace(
  PREFIX="/opt/python9.8",
  argv0="python",
  ENV_PATH="/usr/bin:/opt/python9.8/bin",
  )
  ns.add_known_xfile("/opt/python9.8/bin/python")
  ns.add_known_file("/opt/python9.8/lib/python9.8/os.py")
  ns.add_known_dir("/opt/python9.8/lib/python9.8/lib-dynload")
  
  # This shouldn't matter:
  ns.add_known_file("/opt/lib/python98.zip")
  
  expected = dict(
  executable="/opt/python9.8/bin/python",
  base_executable="/opt/python9.8/bin/python",
  prefix="/opt/python9.8",
  exec_prefix="/opt/python9.8",
  module_search_paths_set=1,
  module_search_paths=[
  "/opt/python9.8/lib/python98.zip",
  "/opt/python9.8/lib/python9.8",
  "/opt/python9.8/lib/python9.8/lib-dynload",
  ],
  )
  actual = getpath(ns, expected)
  self.assertEqual(expected, actual)

This could be problematic, adding a suitably named file outside of $PREFIX 
breaks the python installation.  I haven't checked this with an unchanged 
getpath.py yet, but I shouldn't have made any changes that affect a 
non-framework install.

--

___
Python tracker 

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



[issue46933] Make pwd module optional for wasm32-emscripten and wasi

2022-03-07 Thread Erlend E. Aasland


Change by Erlend E. Aasland :


--
nosy: +erlendaasland
nosy_count: 1.0 -> 2.0
pull_requests: +29854
pull_request: https://github.com/python/cpython/pull/31737

___
Python tracker 

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



Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
Thanks to MRAB and Chris Angelico for your help.  Here is how I implemented the 
string conversion, and it works correctly now for a library call that needs a 
list converted to a string (error handling not shown):

PyObject* str_sentence = PyObject_Str(pSentence);  
PyObject* separator = PyUnicode_FromString(" ");
PyObject* str_join = PyUnicode_Join(separator, pSentence);
Py_DECREF(separator);
PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr, "word_tokenize");
PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, str_join, 0);

That produces what I need (this is the REPR of pWTok):

"['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

Thanks again to both of you. 

Jen


Mar 7, 2022, 11:03 by pyt...@mrabarnett.plus.com:

> On 2022-03-07 17:05, Jen Kris wrote:
>
>> Thank you MRAB for your reply.
>>
>> Regarding your first question, pSentence is a list.  In the nltk library, 
>> nltk.word_tokenize takes a string, so we convert sentence to string before 
>> we call nltk.word_tokenize:
>>
>> >>> sentence = " ".join(sentence)
>> >>> pt = nltk.word_tokenize(sentence)
>> >>> print(sentence)
>> [ Emma by Jane Austen 1816 ]
>>
>> But with the C API it looks like this:
>>
>> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
>> PyObject* str_sentence = PyObject_Str(pSentence); // Convert to string
>>
>> ; See what str_sentence looks like:
>> PyObject* repr_str = PyObject_Repr(str_sentence);
>> PyObject* str_str = PyUnicode_AsEncodedString(repr_str, "utf-8", "~E~");
>> const char *bytes_str = PyBytes_AS_STRING(str_str);
>> printf("REPR_String: %s\n", bytes_str);
>>
>> REPR_String: "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
>>
>> So the two string representations are not the same – or at least the   
>> PyUnicode_AsEncodedString is not the same, as each item is surrounded by 
>> single quotes.
>>
>> Assuming that the conversion to bytes object for the REPR is an accurate 
>> representation of str_sentence, it looks like I need to strip the quotes 
>> from str_sentence before “PyObject* pWTok = 
>> PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0).”
>>
>> So my questions now are (1) is there a C API function that will convert a 
>> list to a string exactly the same way as ‘’.join, and if not then (2) how 
>> can I strip characters from a string object in the C API?
>>
> Your Python code is joining the list with a space as the separator.
>
> The equivalent using the C API is:
>
>     PyObject* separator;
>     PyObject* joined;
>
>     separator = PyUnicode_FromString(" ");
>     joined = PyUnicode_Join(separator, pSentence);
>     Py_DECREF(sep);
>
>>
>> Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:
>>
>>  On 2022-03-07 00:32, Jen Kris via Python-list wrote:
>>
>>  I am using the C API in Python 3.8 with the nltk library, and
>>  I have a problem with the return from a library call
>>  implemented with PyObject_CallFunctionObjArgs.
>>
>>  This is the relevant Python code:
>>
>>  import nltk
>>  from nltk.corpus import gutenberg
>>  fileids = gutenberg.fileids()
>>  sentences = gutenberg.sents(fileids[0])
>>  sentence = sentences[0]
>>  sentence = " ".join(sentence)
>>  pt = nltk.word_tokenize(sentence)
>>
>>  I run this at the Python command prompt to show how it works:
>>
>>  sentence = " ".join(sentence)
>>  pt = nltk.word_tokenize(sentence)
>>  print(pt)
>>
>>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>>  type(pt)
>>
>>  
>>
>>  This is the relevant part of the C API code:
>>
>>  PyObject* str_sentence = PyObject_Str(pSentence);
>>  // nltk.word_tokenize(sentence)
>>  PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr,
>>  "word_tokenize");
>>  PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok,
>>  str_sentence, 0);
>>
>>  (where pModule_mstr is the nltk library).
>>
>>  That should produce a list with a length of 7 that looks like
>>  it does on the command line version shown above:
>>
>>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>>  But instead the C API produces a list with a length of 24, and
>>  the REPR looks like this:
>>
>>  '[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\',
>>  "\'by", "\'", \',\', "\'Jane", "\'", \',\', "\'Austen", "\'",
>>  \',\', "\'1816", "\'", \',\', "\'", \']\', "\'", \']\']'
>>
>>  I also tried this with PyObject_CallMethodObjArgs and
>>  PyObject_Call without success.
>>
>>  Thanks for any help on this.
>>
>>  What is pSentence? Is it what you think it is?
>>  To me it looks like it's either the list:
>>
>>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>>  or that list as a string:
>>
>>  "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
>>
>>  and that what you're tokenising.
>>  -- https://mail.python.org/mailman/listinfo/python-list
>>
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue46947] unicodedata.name gives ValueError for control characters

2022-03-07 Thread Joe Cool


Joe Cool  added the comment:

Note: This is an issue for all chars in the ordinal range 0 thru 31.

--

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset e1639f361ee0dfbf08bb8538839d3d557c1a995c by Steve Dower in branch 
'3.9':
bpo-44549: Update bzip2 to 1.0.8 in Windows builds to mitigate CVE-2016-3189 
and CVE-2019-12900 (GH-31732)
https://github.com/python/cpython/commit/e1639f361ee0dfbf08bb8538839d3d557c1a995c


--

___
Python tracker 

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



[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
nosy: +steve.dower

___
Python tracker 

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



[issue46841] Inline bytecode caches

2022-03-07 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset f193631387bfee99a812e39b05d5b7e6384b57f5 by Brandt Bucher in 
branch 'main':
bpo-46841: Use inline caching for calls (GH-31709)
https://github.com/python/cpython/commit/f193631387bfee99a812e39b05d5b7e6384b57f5


--

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Ned Deily


Ned Deily  added the comment:


New changeset 4a3c610cd635f14747cf02c77908e80620aae6ea by Steve Dower in branch 
'3.7':
bpo-44549: Update bzip2 to 1.0.8 in Windows builds to mitigate CVE-2016-3189 
and CVE-2019-12900 (GH-31732) (GH-31735)
https://github.com/python/cpython/commit/4a3c610cd635f14747cf02c77908e80620aae6ea


--

___
Python tracker 

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



[issue46913] UBSAN: test_ctypes, test_faulthandler and test_hashlib are failing

2022-03-07 Thread Martin Panter


Martin Panter  added the comment:

The ctypes overflow is probably the same as described in Issue 28169 and Issue 
15119

--
nosy: +martin.panter

___
Python tracker 

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



Re: Behavior of the for-else construct

2022-03-07 Thread Antoon Pardon



Op 4/03/2022 om 02:08 schreef Avi Gross via Python-list:

If Python was being designed TODAY, I wonder if a larger set of key words would 
be marked as RESERVED for future expansion including ORELSE and even 
NEVERTHELESS.


I think a better solution would be to have reserved words written letters form 
the mathematical lettter block.

Something like:

퐝퐞퐟 foo(bar):
   in = file(...)
   퐟퐨퐫 line 퐢퐧 in:
  ...

--
https://mail.python.org/mailman/listinfo/python-list


[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29851
pull_request: https://github.com/python/cpython/pull/31734

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29852
pull_request: https://github.com/python/cpython/pull/31735

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29850
pull_request: https://github.com/python/cpython/pull/31733

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset 58d576a43cb1800dd68f06a429d7d41f746a8c01 by Steve Dower in branch 
'3.10':
bpo-44549: Update bzip2 to 1.0.8 in Windows builds to mitigate CVE-2016-3189 
and CVE-2019-12900 (GH-31732)
https://github.com/python/cpython/commit/58d576a43cb1800dd68f06a429d7d41f746a8c01


--

___
Python tracker 

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



Re: always return the same pdf

2022-03-07 Thread MRAB

On 2022-03-07 14:08, Gonzalo V wrote:

Hello everyone.
i had upload a Django app to an ubuntu 18.04 server and it gives me the
same pdf everytime the view is called. To generate the pdf it receipts
differents string buy it gives me the same pdf. Could you give some idea
what is happening?

thanks everyone
@never_cached
def generar_pdf(request):
 prueba = request.session.get('contenedor')
 cantidad_preguntas=prueba['cantidad_preguntas']
 archivo_salida = open("prueba.tex","w")

archivo_salida.write("\\documentclass[10pt,oneside,letterpaper]{article}")
 archivo_salida.write("\\usepackage[utf8x]{inputenc}")

   ##hace mas y mas cosas sin importancia con latex que funcionan bien

 archivo_a_descargar = open("prueba.pdf","rb") #
 respuesta =
HttpResponse(archivo_a_descargar,content_type='application/pdf')
 respuesta['Content-Disposition'] = 'attachment; filename="{0}"'.format(
archivo_a_descargar.name)

 return respuesta
Saludos,
Gonzalo


You're using relative paths. Are you sure that they are pointing to the 
correct files?


Is it actually generating the PDF?

You might think that when it generates the PDF it overwrites any 
existing file of that name but is it? Is it simply giving you the PDF 
that's already there?

--
https://mail.python.org/mailman/listinfo/python-list


Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread MRAB

On 2022-03-07 17:05, Jen Kris wrote:

Thank you MRAB for your reply.

Regarding your first question, pSentence is a list.  In the nltk 
library, nltk.word_tokenize takes a string, so we convert sentence to 
string before we call nltk.word_tokenize:


>>> sentence = " ".join(sentence)
>>> pt = nltk.word_tokenize(sentence)
>>> print(sentence)
[ Emma by Jane Austen 1816 ]

But with the C API it looks like this:

PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
PyObject* str_sentence = PyObject_Str(pSentence); // Convert to string

; See what str_sentence looks like:
PyObject* repr_str = PyObject_Repr(str_sentence);
PyObject* str_str = PyUnicode_AsEncodedString(repr_str, "utf-8", "~E~");
const char *bytes_str = PyBytes_AS_STRING(str_str);
printf("REPR_String: %s\n", bytes_str);

REPR_String: "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

So the two string representations are not the same – or at least the   
PyUnicode_AsEncodedString is not the same, as each item is surrounded 
by single quotes.


Assuming that the conversion to bytes object for the REPR is an 
accurate representation of str_sentence, it looks like I need to strip 
the quotes from str_sentence before “PyObject* pWTok = 
PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0).”


So my questions now are (1) is there a C API function that will 
convert a list to a string exactly the same way as ‘’.join, and if not 
then (2) how can I strip characters from a string object in the C API?



Your Python code is joining the list with a space as the separator.

The equivalent using the C API is:

    PyObject* separator;
    PyObject* joined;

    separator = PyUnicode_FromString(" ");
    joined = PyUnicode_Join(separator, pSentence);
    Py_DECREF(sep);



Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:

On 2022-03-07 00:32, Jen Kris via Python-list wrote:

I am using the C API in Python 3.8 with the nltk library, and
I have a problem with the return from a library call
implemented with PyObject_CallFunctionObjArgs.

This is the relevant Python code:

import nltk
from nltk.corpus import gutenberg
fileids = gutenberg.fileids()
sentences = gutenberg.sents(fileids[0])
sentence = sentences[0]
sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)

I run this at the Python command prompt to show how it works:

sentence = " ".join(sentence)
pt = nltk.word_tokenize(sentence)
print(pt)

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

type(pt)



This is the relevant part of the C API code:

PyObject* str_sentence = PyObject_Str(pSentence);
// nltk.word_tokenize(sentence)
PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr,
"word_tokenize");
PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok,
str_sentence, 0);

(where pModule_mstr is the nltk library).

That should produce a list with a length of 7 that looks like
it does on the command line version shown above:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

But instead the C API produces a list with a length of 24, and
the REPR looks like this:

'[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\',
"\'by", "\'", \',\', "\'Jane", "\'", \',\', "\'Austen", "\'",
\',\', "\'1816", "\'", \',\', "\'", \']\', "\'", \']\']'

I also tried this with PyObject_CallMethodObjArgs and
PyObject_Call without success.

Thanks for any help on this.

What is pSentence? Is it what you think it is?
To me it looks like it's either the list:

['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']

or that list as a string:

"['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"

and that what you're tokenising.
-- 
https://mail.python.org/mailman/listinfo/python-list




--
https://mail.python.org/mailman/listinfo/python-list


Non sequitur: Changing subject line... WAS: Behavior of the for-else construct

2022-03-07 Thread Dennis Lee Bieber
On Mon, 7 Mar 2022 18:07:42 +, "Schachner, Joseph"
 declaimed the following:

>Can someone please change the topic of this thread?  No longer about for-else.
>

Pretty much anyone can change the subject of the message when replying.

But if one is using a threaded client, that thread on message
references

Message-ID: 
References: 
 <621325684.471007.1646354302...@mail.yahoo.com>
 <20220304225746.mmebv3myg5wbp...@hjp.at>
 <657845041.42944.1646437629...@mail.yahoo.com>
 <20220305001158.g7rmlyoxxtxuf...@hjp.at>
 
  <1mc72hll06itd6jnbgdherqb3thf1fk...@4ax.com>
 <20220306163951.2ozmrhfbtsktb...@hjp.at>
 
 



it will still appear under the parent message; it will only thread
differently if one's client merely sorts on subject and date/time.


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46945] Quantifier and Expanded Regex Expression Gives Different Results

2022-03-07 Thread Eric V. Smith


Change by Eric V. Smith :


--
components: +Regular Expressions -Library (Lib)
nosy: +ezio.melotti, mrabarnett

___
Python tracker 

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



[Python-announce] [RELEASE] Python 3.11.0a6 is available

2022-03-07 Thread Pablo Galindo Salgado
There are no easy releases these days! :sweat: After a week of delay due to
several release blockers, buildbot problems and pandemic-related
difficulties here is 3.11.0a6 for you to test.

https://www.python.org/downloads/release/python-3110a6/

**This is an early developer preview of Python 3.11**

# Major new features of the 3.11 series, compared to 3.10

Python 3.11 is still in development.  This release, 3.11.0a6 is the sixth
of seven planned alpha releases.

Alpha releases are intended to make it easier to test the current state of
new features and bug fixes and to test the release process.

During the alpha phase, features may be added up until the start of the
beta phase (2022-05-06) and, if necessary, may be modified or deleted up
until the release candidate phase (2022-08-01).  Please keep in mind that
this is a preview release and its use is **not** recommended for production
environments.

Many new features for Python 3.11 are still being planned and written.
Among the new major new features and changes so far:

* [PEP 657](https://www.python.org/dev/peps/pep-0657/) -- Include
Fine-Grained Error Locations in Tracebacks
* [PEP 654](https://www.python.org/dev/peps/pep-0654/) -- Exception Groups
and except*
* [PEP 673](https://www.python.org/dev/peps/pep-0673/)  -- Self Type
* [PEP 646](https://www.python.org/dev/peps/pep-0646/)-- Variadic Generics
* The [Faster Cpython Project](https://github.com/faster-cpython) is
already yielding some exciting results: this version of CPython 3.11 is
~12% faster on the geometric mean of the [PyPerformance benchmarks](
speed.python.org), compared to 3.10.0.
 * Hey, **fellow core developer,** if a feature you find important is
missing from this list, let me know.

The next pre-release of Python 3.11 will be 3.11.0a7, currently scheduled
for Tuesday, 2022-04-05.

# More resources

* [Online Documentation](https://docs.python.org/3.11/)
* [PEP 664](https://www.python.org/dev/peps/pep-0664/), 3.11 Release
Schedule
* Report bugs at [https://bugs.python.org](https://bugs.python.org).
* [Help fund Python and its community](/psf/donations/).

# And now for something completely different

In astrophysics and nuclear physics, nuclear pasta is a theoretical type of
degenerate matter that is postulated to exist within the crusts of neutron
stars. If it does in fact exist, nuclear pasta is the strongest material in
the universe. Between the surface of a neutron star and the quark-gluon
plasma at the core, at matter densities of 1014 g/cm3, nuclear attraction
and Coulomb repulsion forces are of similar magnitude. The competition
between the forces leads to the formation of a variety of complex
structures assembled from neutrons and protons. Astrophysicists call these
types of structures nuclear pasta because the geometry of the structures
resembles various types of pasta.

There are several phases of evolution (I swear these names are real),
including the gnocchi phase, the spaghetti phase, the lasagna phase, the
bucatini phase and the Swiss cheese phase.

# We hope you enjoy those new releases!

Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.

Your friendly release team,
Pablo Galindo @pablogsal
Ned Deily @nad
Steve Dower @steve.dower
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


[issue46932] Please update bundled libexpat to 2.4.7 with an important fix

2022-03-07 Thread Ned Deily


Ned Deily  added the comment:

We haven't released 2.4.6 yet for maintenance/security branches so we probably 
should update to 2.4.7 first.

--
nosy: +corona10, lukasz.langa, ned.deily, pablogsal
priority: normal -> release blocker

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29849
pull_request: https://github.com/python/cpython/pull/31732

___
Python tracker 

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



[issue46950] Windows 11 venv

2022-03-07 Thread Darrel O'Pry


New submission from Darrel O'Pry :

I created a virtual env on windows 11. 
When I run pip install -r "..."
I get the error 
```
C:\Users\dopry\src\Client\some.domain.com\django> pip install -r 
.\requirements_to_freeze.txt
Traceback (most recent call last):
  File "C:\Users\dopry\AppData\Local\Programs\Python\Python310\lib\runpy.py", 
line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
  File "C:\Users\dopry\AppData\Local\Programs\Python\Python310\lib\runpy.py", 
line 86, in _run_code
exec(code, run_globals)
  File 
"C:\Users\dopry\src\Client\some.domain.com\django\venv310\Scripts\pip.exe\__main__.py",
 line 4, in 
ModuleNotFoundError: No module named 'pip'
```

When I run get command to verify that the venv is activated I get

```
(venv310) PS C:\Users\dopry\src\Client\some.domain.com\django> Get-Command 
python

CommandType Name   Version
Source
---    ---
--
Application python.exe 3.10.21... 
C:\Users\dopry\src\Client\some.domain.com\django\venv310\Scripts\python.exe
```

When I update the `venv310\pyenv.cfg` and set `include-system-site-packages = 
true` to true, it was defaulted to false, it seems that I can pip install my 
requirements successfully. 

When I try to start my app though, the requirements are not found.

--
components: Windows
messages: 414691
nosy: darrel.opry, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows 11 venv
type: crash
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset 105b9ac00174d7bcc653f9e9dc5052215e197c77 by Steve Dower in branch 
'main':
bpo-44549: Update bzip2 to 1.0.8 in Windows builds to mitigate CVE-2016-3189 
and CVE-2019-12900 (GH-31731)
https://github.com/python/cpython/commit/105b9ac00174d7bcc653f9e9dc5052215e197c77


--

___
Python tracker 

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



Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-07 Thread Dieter Maurer
Martin Di Paola wrote at 2022-3-6 20:42 +:
>>Try to use `fork` as "start method" (instead of "spawn").
>
>Yes but no. Indeed with `fork` there is no need to pickle anything. In
>particular the child process will be a copy of the parent so it will
>have all the modules loaded, including the dynamic ones. Perfect.
>
>The problem is that `fork` is the default only in Linux. It works in
>MacOS but it may lead to crashes if the parent process is multithreaded
>(and the my is!) and `fork` does not work in Windows.

Then, you must put the initialization (dynamically loading the modules)
into the function executed in the foreign process.

You could wrap the payload function into a class instances to achieve this.
In the foreign process, you call the instance which first performs
the initialization and then executes the payload.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Ned Deily


Change by Ned Deily :


--
priority: critical -> release blocker

___
Python tracker 

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



[issue46744] installers on ARM64 suggest wrong folders

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:

Good call on the batch file. It should be easy enough to make those options 
case-insensitive, and to support both forms of x86 flag. I'll leave this issue 
open for that if someone wants to have a go, otherwise I'll get to them at some 
point.

--

___
Python tracker 

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



RE: Behavior of the for-else construct

2022-03-07 Thread Schachner, Joseph
Can someone please change the topic of this thread?  No longer about for-else.


Teledyne Confidential; Commercially Sensitive Business Data

-Original Message-
From: Dennis Lee Bieber  
Sent: Sunday, March 6, 2022 1:29 PM
To: python-list@python.org
Subject: Re: Behavior of the for-else construct

On Sun, 6 Mar 2022 17:39:51 +0100, "Peter J. Holzer"  
declaimed the following:

>
>(* *) for comments was actually pretty commonly used - maybe because it 
>stands out more than { }. I don't know if I've ever seen (. .) instead 
>of [ ].
>
Or some terminals provided [ ] but not { }  

Modula-2 appears to have fixed on (* *) for comments, and only [ ] for 
indexing.

Consider the potential mayhem going from a language where { } are 
comment delimiters to one where they are block delimiters 


>C also has alternative rerpresentations for characters not in the 
>common subset of ISO-646 and EBCDIC. However, the trigraphs are 
>extremely ugly (e.g ??< ??> instead of { }). I have seen them used (on 
>an IBM/390 system with an EBCDIC variant without curly braces) and it's 
>really no fun to read that.
>
My college mainframe used EBCDIC, but the available languages did not 
include C or Pascal. We had APL, FORTRAN-IV (in full separate compilation form, 
and FLAG [FORTRAN Load and Go] which was a "all in one file, compile & run" 
used by first year students), COBOL (74?), BASIC, SNOBOL, Meta-Symbol and AP 
(both assemblers, though Meta-Symbol could, provided the proper definition 
file, generate absolute binary code for pretty much any processor), and 
something called SL-1 (Simulation Language-1, which produced FORTRAN output for 
discrete event models).

UCSD Pascal, and PDP-11 assembly were run on a pair of LSI-11 systems.
Assembly used for the operating system principles course.

I didn't encounter "real" C until getting a TRS-80 (first as integer 
LC, then Pro-MC), along with Supersoft LISP (on cassette tape!). (I had books 
for C and Ada before encountering compilers for them)


-- 
Wulfraed Dennis Lee Bieber AF6VN
wlfr...@ix.netcom.comhttp://wlfraed.microdiversity.freeddns.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue41370] PEP 585 and ForwardRef

2022-03-07 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset b465b606049f6f7dd0711cb031fdaa251818741a by Niklas Rosenstein in 
branch 'main':
bpo-41370: Evaluate strings as forward refs in PEP 585 generics (GH-30900)
https://github.com/python/cpython/commit/b465b606049f6f7dd0711cb031fdaa251818741a


--

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:

Adding RMs - this should get merged before we do any security releases for 
issue46948

--
nosy: +lukasz.langa, pablogsal
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29848
pull_request: https://github.com/python/cpython/pull/31731

___
Python tracker 

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



[issue44549] Update Windows installer to use bzip2 1.0.8

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:

cpython-source-deps was updated middle of last year, but apparently we never 
merged the main repo change to use it. I'll do it now.

--

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Ned Deily


Ned Deily  added the comment:


New changeset 97476271275a4bd1340230677b7301d7b78b3317 by Steve Dower in branch 
'3.7':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses 
the install path during repair (GH-31730)
https://github.com/python/cpython/commit/97476271275a4bd1340230677b7301d7b78b3317


--

___
Python tracker 

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



Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Chris Angelico
On Tue, 8 Mar 2022 at 04:13, Jen Kris  wrote:
>
>
> The PyObject str_sentence is a string representation of a list.  I need to 
> convert the list to a string like "".join because that's what the library 
> call takes.
>

What you're doing is the equivalent of str(sentence), not
"".join(sentence). Since the join method is part of the string
protocol, you'll find it here:

https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_Join

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46949] Print an indication if traceback exceeds sys.tracebacklimit

2022-03-07 Thread Irit Katriel

Irit Katriel  added the comment:

Re what the limit means, it’s a bit messier than that, see issue38197.

--

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset 101a1bee1953b82339115c5e648e1717359c78eb by Steve Dower in branch 
'3.9':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses 
the install path during repair (GH-31728)
https://github.com/python/cpython/commit/101a1bee1953b82339115c5e648e1717359c78eb


--

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset 77446d2aa56e9e3262d9d22473420ff5e907 by Steve Dower in branch 
'main':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses 
the install path during repair (GH-31726)
https://github.com/python/cpython/commit/77446d2aa56e9e3262d9d22473420ff5e907


--

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:


New changeset 136842c91b5783e205e217c4855baa9dadd4ad41 by Steve Dower in branch 
'3.10':
bpo-46948: Fix CVE-2022-26488 by ensuring the Windows Installer correctly uses 
the install path during repair (GH-31727)
https://github.com/python/cpython/commit/136842c91b5783e205e217c4855baa9dadd4ad41


--

___
Python tracker 

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



[issue46949] Print an indication if traceback exceeds sys.tracebacklimit

2022-03-07 Thread Eric V. Smith


Eric V. Smith  added the comment:

If you go with the second idea, I'd say something like f"More than {2 * 
tracebacklimit} additional stack frames not shown". It seems handy to know the 
magnitude of the problem.

--
nosy: +eric.smith

___
Python tracker 

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



Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list

The PyObject str_sentence is a string representation of a list.  I need to 
convert the list to a string like "".join because that's what the library call 
takes.  


Mar 7, 2022, 09:09 by ros...@gmail.com:

> On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list
>  wrote:
>
>> But with the C API it looks like this:
>>
>> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
>> PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string
>>
>> PyObject* repr_str = PyObject_Repr(str_sentence);
>>
>
> You convert it to a string, then take the representation of that. Is
> that what you intended?
>
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:

Yeah, this is fine to still be in alpha 6. Very unlikely that anyone is making 
it a system-wide default anyway, and certainly not in secure/production systems.

--

___
Python tracker 

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



Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Chris Angelico
On Tue, 8 Mar 2022 at 04:06, Jen Kris via Python-list
 wrote:
> But with the C API it looks like this:
>
> PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
> PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string
>
> PyObject* repr_str = PyObject_Repr(str_sentence);

You convert it to a string, then take the representation of that. Is
that what you intended?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The 3.11.0a6 release is ongoing. I assume is ok to not block this release on 
this issue, given that an alpha is inherently unsafe

--

___
Python tracker 

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



Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-07 Thread Jen Kris via Python-list
Thank you MRAB for your reply.

Regarding your first question, pSentence is a list.  In the nltk library, 
nltk.word_tokenize takes a string, so we convert sentence to string before we 
call nltk.word_tokenize:

>>> sentence = " ".join(sentence)
>>> pt = nltk.word_tokenize(sentence)
>>> print(sentence)
[ Emma by Jane Austen 1816 ]

But with the C API it looks like this:

PyObject *pSentence = PySequence_GetItem(pSents, sent_count);
PyObject* str_sentence = PyObject_Str(pSentence);  // Convert to string

; See what str_sentence looks like:
PyObject* repr_str = PyObject_Repr(str_sentence);  
PyObject* str_str = PyUnicode_AsEncodedString(repr_str, "utf-8", "~E~");  
const char *bytes_str = PyBytes_AS_STRING(str_str);
printf("REPR_String: %s\n", bytes_str); 

REPR_String: "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
So the two string representations are not the same – or at least the   
PyUnicode_AsEncodedString is not the same, as each item is surrounded by single 
quotes. 

Assuming that the conversion to bytes object for the REPR is an accurate 
representation of str_sentence, it looks like I need to strip the quotes from 
str_sentence before “PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, 
str_sentence, 0).”   

So my questions now are (1) is there a C API function that will convert a list 
to a string exactly the same way as ‘’.join, and if not then (2) how can I 
strip characters from a string object in the C API? 

Thanks.



Mar 6, 2022, 17:42 by pyt...@mrabarnett.plus.com:

> On 2022-03-07 00:32, Jen Kris via Python-list wrote:
>
>> I am using the C API in Python 3.8 with the nltk library, and I have a 
>> problem with the return from a library call implemented with 
>> PyObject_CallFunctionObjArgs.
>>
>> This is the relevant Python code:
>>
>> import nltk
>> from nltk.corpus import gutenberg
>> fileids = gutenberg.fileids()
>> sentences = gutenberg.sents(fileids[0])
>> sentence = sentences[0]
>> sentence = " ".join(sentence)
>> pt = nltk.word_tokenize(sentence)
>>
>> I run this at the Python command prompt to show how it works:
>>
> sentence = " ".join(sentence)
> pt = nltk.word_tokenize(sentence)
> print(pt)
>
>> ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
> type(pt)
>
>> 
>>
>> This is the relevant part of the C API code:
>>
>> PyObject* str_sentence = PyObject_Str(pSentence);
>> // nltk.word_tokenize(sentence)
>> PyObject* pNltk_WTok = PyObject_GetAttrString(pModule_mstr, "word_tokenize");
>> PyObject* pWTok = PyObject_CallFunctionObjArgs(pNltk_WTok, str_sentence, 0);
>>
>> (where pModule_mstr is the nltk library).
>>
>> That should produce a list with a length of 7 that looks like it does on the 
>> command line version shown above:
>>
>> ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>>
>> But instead the C API produces a list with a length of 24, and the REPR 
>> looks like this:
>>
>> '[\'[\', "\'", \'[\', "\'", \',\', "\'Emma", "\'", \',\', "\'by", "\'", 
>> \',\', "\'Jane", "\'", \',\', "\'Austen", "\'", \',\', "\'1816", "\'", 
>> \',\', "\'", \']\', "\'", \']\']'
>>
>> I also tried this with PyObject_CallMethodObjArgs and PyObject_Call without 
>> success.
>>
>> Thanks for any help on this.
>>
> What is pSentence? Is it what you think it is?
> To me it looks like it's either the list:
>
>  ['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']
>
> or that list as a string:
>
>  "['[', 'Emma', 'by', 'Jane', 'Austen', '1816', ']']"
>
> and that what you're tokenising.
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue46949] Print an indication if traceback exceeds sys.tracebacklimit

2022-03-07 Thread Jelle Zijlstra


Jelle Zijlstra  added the comment:

It skips the least recent frames:

>>> def error(): 1 / 0
... 
>>> def g(): error()
... 
>>> def f(): g()
... 
>>> sys.tracebacklimit = 2
>>> f()
Traceback (most recent call last):
  File "", line 1, in g
  File "", line 1, in error
ZeroDivisionError: division by zero
>>> sys.tracebacklimit = 5
>>> f()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1, in f
  File "", line 1, in g
  File "", line 1, in error
ZeroDivisionError: division by zero

(tried on current main)

I think that's the right behavior because it tells you the function that 
actually throws the error, which is much harder to figure out from scratch than 
where the call started.

--

___
Python tracker 

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



[issue46890] venv does not create "python" link in python 3.11

2022-03-07 Thread Steve Dower


Steve Dower  added the comment:

> I have a patch that seems to do the right thing. It required adding 
> WITH_NEXT_FRAMEWORK to the globals when evaluating getpath.py to detect this 
> scenario.

I haven't had a chance to go through all your changes, and I'm only very 
vaguely familiar with this space anyway, but isn't WITH_NEXT_FRAMEWORK a 
compile-time option? I'm sure that's how it was used in the old getpath.

> Is there a way to find the values that get put into the globals dict for 
> getpath.py without using a debugger

warn(str(globals())) or some variant at the top of getpath.py should do it. 
There's also an "#if 0" section in getpath.c that will print it out (unless I 
deleted it before merging). There's nothing permanently built in to do this, as 
I suspect the security concerns (information leakage) would come up more often 
than the debugging concerns.

--

___
Python tracker 

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



[issue46949] Print an indication if traceback exceeds sys.tracebacklimit

2022-03-07 Thread Guido van Rossum


Guido van Rossum  added the comment:

There is general confusion as to which part of the traceback is truncated. If I 
have main() -> f() -> g() -> error(), and the limit is 2, does it print main() 
-> f(), or does it print g() -> error()? (I'm not even sure which would be more 
useful.)

FWIW the reason I suggested printing "many" is a worry that somehow a bug could 
cause counting the length of the list to take forever (e.g. if it ends in a 
cycle). It would seem more robust to limit the count.

--

___
Python tracker 

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



[issue46949] Print an indication if traceback exceeds sys.tracebacklimit

2022-03-07 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

If the number of frames in a traceback exceeds sys.tracebacklimit (which 
defaults to 1000), any remaining frames are silently dropped. See 
https://docs.python.org/3.10/library/sys.html#sys.tracebacklimit.

This is confusing to users. We should print some indication like "N additional 
stack frames not shown".

Here are some specific ideas:
- tracebacklimit <= 0 is documented as dropping the whole traceback. In that 
case, we don't need too print any message.
- It may be expensive to compute a complete count. Perhaps we can count frames 
up to 2 * tracebacklimit, and just say "Many additional stack frames not shown".
- The C implementation is in tb_print_internal() in traceback.c, and the Python 
one in _extract_from_extended_frame_gen in traceback.py.

--
components: Interpreter Core
messages: 414674
nosy: Jelle Zijlstra, gvanrossum, iritkatriel
priority: normal
severity: normal
status: open
title: Print an indication if traceback exceeds sys.tracebacklimit
type: enhancement
versions: Python 3.11

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29847
pull_request: https://github.com/python/cpython/pull/31730

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29846
pull_request: https://github.com/python/cpython/pull/31729

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29845
pull_request: https://github.com/python/cpython/pull/31728

___
Python tracker 

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



[issue46948] [CVE-2022-26488] Escalation of privilege via Windows Installer

2022-03-07 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +29844
pull_request: https://github.com/python/cpython/pull/31727

___
Python tracker 

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



  1   2   >