[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

'Consistency' is in the eye of the beholder in that it is relative to some 
ideal.  'Inconsistent' has too much baggage as bad'.  I would prefer to call 
the current rule 'restricted' or 'limited' and judge any expansion on its own 
merits.

The arguments to print can take an unbounded amount of space.  So a general 
message "Did you mean print()?" could also be indefinitely 
long.  I don't think this is a good idea.  Of course, the same applies to a 
single literal, especially multiline string literals.  But at least the latter 
are currently clipped to only the first line in the message.

>>> print '''first line
second line'''
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print('''first line)?

(The above would be better with trailing ... .) This abbreviation would be 
harder with multiple arguments.  The special message is for beginners.  They 
might print a literal or name without ()s more frequently.  I not sure that 
they need the reminder with every mistake.

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Ammar Askar


Ammar Askar  added the comment:

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

--
nosy: +ammar2

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2021-02-18 Thread Vedran Čačić

Vedran Čačić  added the comment:

Aren't we overthinking this? Python 2 is a dead language. It has reached end of 
life more than a year ago (and was scheduled to do so in 2015). Why are we 
still trying to accomodate something that stopped being relevant a long time 
ago?

--
nosy: +veky

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-18 Thread Ramin Farajpour Cami


Change by Ramin Farajpour Cami :


--
type:  -> crash

___
Python tracker 

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



[issue43262] "_weakrefset.py", line 56: IndexError: pop from empty list

2021-02-18 Thread Jinghao Shi


New submission from Jinghao Shi :

One of our asyncio based application sporadically crash due to this stack trace:

```
File ".../lib/python3.8/asyncio/runners.py", line 48, in run
loop.run_until_complete(loop.shutdown_asyncgens())
  File ".../lib/python3.8/asyncio/base_events.py", line 595, in 
run_until_complete
future = tasks.ensure_future(future, loop=self)
  File ".../lib/python3.8/asyncio/tasks.py", line 669, in ensure_future
task = loop.create_task(coro_or_future)
  File ".../lib/python3.8/asyncio/base_events.py", line 431, in create_task
task = tasks.Task(coro, loop=self, name=name)
  File ".../lib/python3.8/_weakrefset.py", line 83, in add
self._commit_removals()
  File ".../lib/python3.8/_weakrefset.py", line 56, in _commit_removals
discard(l.pop())
IndexError: pop from empty list
```

We do not have a reliable repro. From reading the source code, it appears we 
should never try to pop from empty list:

```
 def _commit_removals(self):
l = self._pending_removals
discard = self.data.discard
while l:
discard(l.pop()) # <-- HERE
```

--
components: asyncio
messages: 387288
nosy: asvetlov, jhshi89, yselivanov
priority: normal
severity: normal
status: open
title: "_weakrefset.py", line 56: IndexError: pop from empty list
type: crash
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



[issue43260] Never release buffer when MemoryError in print()

2021-02-18 Thread Ramin Farajpour Cami


Ramin Farajpour Cami  added the comment:

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec  7 2020, 16:33:24) [MSC v.1928 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print("a"*10)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> print("1")
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>>

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-18 Thread Ramin Farajpour Cami


Ramin Farajpour Cami  added the comment:

Version : 

Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit 
(Intel)] on win32

--

___
Python tracker 

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



[issue43261] Python 3.9 repair on Windows do not recover pip module

2021-02-18 Thread Svyatoslav


New submission from Svyatoslav :

I by mistake run command `pip install -U pip setuptools wheel` on Windows which 
deleted pip and did not install a new version. I decided to repair Python using 
3.9.1 installer option. But after repair pip still was not installed.

--
components: Windows
messages: 387285
nosy: Prometheus3375, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python 3.9 repair on Windows do not recover pip module
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue43223] [security] http.server: Open Redirection if the URL path starts with //

2021-02-18 Thread Hamza AVvan


Hamza AVvan  added the comment:

As for the directory issue, not only .ssh but an attacker can use any directory 
to make the open redirection exploitable.

And as for the HTTP Header Location, the server does not remove extra trailing 
slash from the PAYLOAD uri, which seems to be the cause of vulnerability 
getting exploited.

http://127.0.0.1:8000//attacker.com/..%2f..%2f..%2f..%2f..%2f../%0a%0d/../.ssh

So I believe the server should check for multiple slashes and remove them from 
the path. 

Additionally, as you've mentioned it should also prepend the host:port/ to the 
new_url variable before writing the HTTP Header Location because if an attacker 
bypasses the protection and add an extra slash the server will still redirect 
to the host which is getting inserted into the Location header. But honestly I 
need your opinion as concatenating host to the url may lead to Host Header 
Injection but it'll then require a different context.

Please watch the POC video.
POC Video: https://youtu.be/rLfOoEu1XXg

--

___
Python tracker 

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-18 Thread paul j3


paul j3  added the comment:

The mutually exclusive arguments are displayed with in the argument group, at 
least in my testing.  From a copy-n-paste of your example:

In [8]: parser.print_help()
usage: ipython3 [-h]
[--from-args FROM_ARGS | --from-files FROM_FILES | --from-stdin 
FROM_STDIN]
[-0 0]

optional arguments:
  -h, --helpshow this help message and exit

INPUT OPTIONS:
  --from-args FROM_ARGS
  --from-files FROM_FILES
  --from-stdin FROM_STDIN
  -0 0  null delimited pathnames


I've had occasion to note that this is the only kind of group nesting that 
works (or makes sense).

In add_container_actions, there is a comment:

# add container's mutually exclusive groups
# NOTE: if add_mutually_exclusive_group ever gains title= and
# description= then this code will need to be expanded as above

So the original developer envisioned giving a mutually exclusive group a 
formatting role, but with this nesting this isn't needed (that I can tell).  
But I don't think this has been documented.

--

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in print()

2021-02-18 Thread Ramin Farajpour Cami


Change by Ramin Farajpour Cami :


--
title: Never release buffer when MemoryError in prtin() -> Never release buffer 
when MemoryError in print()

___
Python tracker 

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



[issue43260] Never release buffer when MemoryError in prtin()

2021-02-18 Thread Ramin Farajpour Cami


New submission from Ramin Farajpour Cami :

Hi,


When we use "a"*100 in print("a"*100) function, Show 
"MemoryError",Again i use print("1") again display  "MemoryError", I think 
memory not release for use again, 


>>> print("a"*10)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> print("1")
Traceback (most recent call last):
  File "", line 1, in 
MemoryError

When i exit() python interpeter, and again print("1") it's work.

And I test in linux its' work:
>>> print("a"*10)
Traceback (most recent call last):
  File "", line 1, in 
MemoryError
>>> print("1")
1
>>> print("a")
a
>>>


Thanks.
Ramin

--
components: Windows
messages: 387282
nosy: Ramin Farajpour Cami, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Never release buffer when MemoryError in prtin()
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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-18 Thread hai shi


Change by hai shi :


--
nosy: +paul.j3, rhettinger

___
Python tracker 

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



[issue41847] Update "install launcher for all users" installer option

2021-02-18 Thread Eryk Sun


Eryk Sun  added the comment:

> but at least for clean installs of 3.10 we can avoid the need 
> for admin completely

Except updating PATHEXT always requires admin access. I do this manually by 
setting a user PATHEXT variable with %PATHEXT% as the first item and append the 
extensions that I need. This is okay because the system environment gets 
populated before the user environment, and a system environment that doesn't 
define PATHEXT is improperly configured. I don't know whether WiX/MSI can 
support this, but it's probably not worth the hassle and potential problems.

--
nosy: +eryksun

___
Python tracker 

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



[issue42840] `type` takes **kwargs for __init_subclass__

2021-02-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'll try to review it in the coming weeks.

--

___
Python tracker 

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



[issue43246] Dict copy optimization violates subclass invariant

2021-02-18 Thread Inada Naoki


Inada Naoki  added the comment:

I am not sure this should be fixed.

If so, I think we should use PyDict_CheckExact() instead of PyDict_Check() && 
(tp_iter is overridden || keys() is overridden || sq_item is overridden).

--
nosy: +rhettinger

___
Python tracker 

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



[issue43259] argparse: allow add_mutually_exclusive_group on add_argument_group

2021-02-18 Thread Christoph Anton Mitterer


New submission from Christoph Anton Mitterer :

Hey.

AFAIU, the sole purpose of ArgumentParser.add_argument_group() is for the 
grouping within the help output.

It would be nice, if one could create a mutually exclusive group (with 
ArgumentParser.add_mutually_exclusive_group) from/within such a "normal" group, 
so that the mutually exclusive arguments are listed within the group, but are 
still, mutually exclusive.

Right now when doing something like:
parser = argparse.ArgumentParser()
parser_group = parser.add_argument_group("INPUT OPTIONS")
parser_group_mutually_exclusive = 
parser_group.add_mutually_exclusive_group(required=False)
parser_group_mutually_exclusive.add_argument("--from-args")
parser_group_mutually_exclusive.add_argument("--from-files")
parser_group_mutually_exclusive.add_argument("--from-stdin")
parser_group.add_argument("-0", help="null delimited pathnames")

it works, but the mutually exclusive options are note printed within the "INPUT 
OPTIONS", but rather at the normal "optional arguments:" section of the help.

The above example also kinda shows what this could be used for:
- one might have e.g. a group for input options, and amongst that the mutually 
exclusive "--from-*" which specify the source of the input.


Cheers,
Chris.

--
components: Library (Lib)
messages: 387278
nosy: calestyo
priority: normal
severity: normal
status: open
title: argparse: allow add_mutually_exclusive_group on add_argument_group
type: enhancement

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset 138488750512b47f1773630f90e92ec5038b6978 by Miss Islington (bot) 
in branch '3.9':
closes bpo-43254: Fix *snprintf() man page refs. (GH-24563)
https://github.com/python/cpython/commit/138488750512b47f1773630f90e92ec5038b6978


--

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread miss-islington


miss-islington  added the comment:


New changeset 8a42eb1492dec2ec0cc79146f0c817acb7328b19 by Miss Islington (bot) 
in branch '3.8':
closes bpo-43254: Fix *snprintf() man page refs. (GH-24563)
https://github.com/python/cpython/commit/8a42eb1492dec2ec0cc79146f0c817acb7328b19


--

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23351
pull_request: https://github.com/python/cpython/pull/24572

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +23350
pull_request: https://github.com/python/cpython/pull/24571

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset e92d67dfbb4790df37aa6a0961fb6dc7e8d2fbbf by Erlend Egeberg 
Aasland in branch 'master':
closes bpo-43254: Fix *snprintf() man page refs. (GH-24563)
https://github.com/python/cpython/commit/e92d67dfbb4790df37aa6a0961fb6dc7e8d2fbbf


--
nosy: +benjamin.peterson
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



[issue39448] Add regen-frozen makefile target

2021-02-18 Thread Neil Schemenauer


Change by Neil Schemenauer :


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



[issue39448] Add regen-frozen makefile target

2021-02-18 Thread Neil Schemenauer


Neil Schemenauer  added the comment:


New changeset ffa55d21b4a86ad8b4a43a9f597151e526541130 by Neil Schemenauer in 
branch 'master':
bpo-39448: Add regen-frozen makefile target. (GH-18174)
https://github.com/python/cpython/commit/ffa55d21b4a86ad8b4a43a9f597151e526541130


--

___
Python tracker 

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



[issue41847] Update "install launcher for all users" installer option

2021-02-18 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 4.0 -> 5.0
pull_requests: +23349
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24570

___
Python tracker 

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



[issue43258] Prevent needless allocation of sqlite3 aggregate function context

2021-02-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue43115] locale.getlocale fails if locale is set

2021-02-18 Thread Marc-Andre Lemburg


Marc-Andre Lemburg  added the comment:

On 18.02.2021 19:04, Eryk Sun wrote:
> 
> Eryk Sun  added the comment:
> 
>> The APIs were written at a time where locale modifiers 
>> simply did mot exist. 
> 
> Technically, locale modifiers did exist circa 2000, but I suppose you mean 
> that they were uncommon to the point of being unheard of at the time.
> 
> The modifier field was specified in the X/Open Portability Guide Issue 3 
> (XPG3) in 1989, and again in XPG4 in 1992 as 
> "language[_territory][.codeset][@modifier]". I can't provide links to the 
> specifications (they're not freely available), but here's a link to X/Open 
> "Internationalisation Guide Version 2" (1993), which defines the modifier 
> field in section 5.1.2 (pages 88-89):
> 
> https://pubs.opengroup.org/onlinepubs/009269599/toc.pdf

Thanks for the link.

The standard may have already been defined in POSIX, but I'm pretty
sure this was not a thing on the SuSE Linux system I was working off
at the time :-)

This is what glibc supported in 2000:

https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED;h=5ca1beb8eacbe5d86322cb2d015ec260422813d8;hb=1914953f71bf9ace1981d838b3777e473e63e8d1

vs. today:

https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED

The first time I ever saw @modifiers in the wild was when the
Euro symbol was introduced in preparation for Jan 1, 2002.

Note that the encoding alias table in Python 2.0 does include an
entry "utf8@ucs4", which originated from the X11 local.alias file.
Apparently those modifiers were already in use on Digital Unix
at the time:

https://github.com/freedesktop/xorg-libX11/blob/deae12c6b683898f5213992d561a59d4ea889cca/nls/locale.alias.pre
(this is from 2003; couldn't find earlier references)

It is interesting to see that the locale.alias.pre file actually
did include Windows locale definitions. On Linux, those don't get
compiled in, so I didn't get to see them :-)

Also interesting is that they aliased e.g. cp1252 to ISO-8859-1,
even though the two encodings are not the same.

--

___
Python tracker 

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



[issue43258] Prevent needless allocation of sqlite3 aggregate function context

2021-02-18 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

If no rows match an aggregate query, _pysqlite_step_callback() is never called, 
and _pysqlite_final_callback() is called once. In order to prevent needless 
context allocation, we should pass 0 as the second argument to 
sqlite3_aggregate_context().


Quoting from https://sqlite.org/c3ref/aggregate_context.html:

Within the xFinal callback, it is customary to set N=0 in calls to 
sqlite3_aggregate_context(C,N) so that no pointless memory allocations occur.

--
components: Library (Lib)
messages: 387272
nosy: berker.peksag, erlendaasland, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Prevent needless allocation of sqlite3 aggregate function context
versions: Python 3.10

___
Python tracker 

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



[issue43257] get_type_hints evaluates class variables before type hints

2021-02-18 Thread Eric V. Smith


Change by Eric V. Smith :


--
nosy: +eric.smith

___
Python tracker 

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



[issue42840] `type` takes **kwargs for __init_subclass__

2021-02-18 Thread Erik Soma


Erik Soma  added the comment:

The CPython PR has gone stale waiting for core review, pinging this per the dev 
guide.

--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> Mr. Stinner, in what way would int.bit_count() be beneficial to me?

I found https://www.chessprogramming.org/Population_Count when I investigated 
the C implementation of _Py_popcount32(), which is used by int.bit_count().

I read it when I tried to document this surprising code:
---
x = x - ((x >> 1) & 0x);
x = (x & 0x) + ((x >> 2) & 0x);
x = (x + (x >> 4)) & 0x0F0F0F0F;
return (uint32_t)((uint64_t)x * (uint64_t)0x01010101) >> 24;
---

I reformatted it as:
---
// 32-bit SWAR (SIMD Within A Register) popcount

// Binary: 0 1 0 1 ...
const uint32_t M1 = 0x;
// Binary: 00 11 00 11. ..
const uint32_t M2 = 0x;
// Binary:     ...
const uint32_t M4 = 0x0F0F0F0F;
// 256**4 + 256**3 + 256**2 + 256**1
const uint32_t SUM = 0x01010101;

// Put count of each 2 bits into those 2 bits
x = x - ((x >> 1) & M1);
// Put count of each 4 bits into those 4 bits
x = (x & M2) + ((x >> 2) & M2);
// Put count of each 8 bits into those 8 bits
x = (x + (x >> 4)) & M4;
// Sum of the 4 byte counts
return (uint32_t)((uint64_t)x * (uint64_t)SUM) >> 24;
---

--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Boštjan Mejak

Boštjan Mejak  added the comment:

My hat off to you, Mr. Peters! Your suggestion (len(moves) + 1) // 2 works 
perfectly and is much more elegant than --0-- len(moves) // 2. :)

Mr. Stinner, in what way would int.bit_count() be beneficial to me?

--

___
Python tracker 

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



[issue2142] difflib.unified_diff(...) produces invalid patches

2021-02-18 Thread Dirkjan Ochtman


Change by Dirkjan Ochtman :


--
nosy:  -djc

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> Anyway, my need for ceiling is that I am coding a chess GUI where I have a 
> table with 2 columns and I create a new row whenever White makes a move. So, 
> my implementation for row creation is math.ceil(len(moves) // 2) where moves 
> is a list of chess moves. 

You may like the new int.bit_count() attribute of Python 3.10 ;-)
https://docs.python.org/dev/library/stdtypes.html#int.bit_count

--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Tim Peters


Tim Peters  added the comment:

(len(moves) + 1) // 2

--
nosy: +tim.peters

___
Python tracker 

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



[issue43257] get_type_hints evaluates class variables before type hints

2021-02-18 Thread Josue Balandrano Coronel


New submission from Josue Balandrano Coronel :

Using typing.get_type_hints() on classes returns the wrong value when a class 
variable has the same name as a type and a default value.

For instance:

from dataclasses import dataclass
from typing import get_type_hints

@dataclass
class DataClassHints:
str: str="asdf"

>>> get_type_hints(DataClassHints)
... NameError: name 'asdf' is not defined

Looks like get_type_hints() is using "asdf" as a type.
This is more clear if we use something like datetime:

from datetime import datetime

class ClassHints:
datetime: datetime=datetime.now()

>>> get_type_hints(ClassHints)
... {'datetime': datetime.datetime(2021, 2, 18, 12, 40, 16, 966502)

If we do the same thing in a method get_type_hints works correctly:

class CorrectHints:
def __init__(self, str: str="asdf", datetime: datetime=datetime.now()):
self.str = str
self.datetime = datetime

>>> ch = CorrectHints()
>>> ch.str
... 'asdf'

>>> ch.datetime
... datetime.datetime(2021, 2, 18, 12, 41, 46, 214844)

>>> get_type_hints(CorrectHints.__init__)
... {'str': str, 'datetime': datetime.datetime}

Also functions work correctly:
 
def func_type_hints(str: str="asdf", datetime: datetime=datetime.now()):
return f"str: {str}, datetime: {datetime}"


>>> func_type_hints()
... 'str: asdf, datetime: 2021-02-18 12:44:21.102933'

>>> get_type_hints(func_type_hints)
... {'str': str, 'datetime': datetime.datetime}

It looks like get_type_hints is evaluating the default value in a class 
variable before the type hint.
Here's another way to replicate this issue to make it clearer:

class EvalOrderHints:
datetime = datetime.now()
datetime: datetime

>>> get_type_hints(EvalOrderHints)
... {'datetime': datetime.datetime(2021, 2, 18, 12, 47, 56, 608261)}

>>> EvalOrderHints().datetime
... datetime.datetime(2021, 2, 18, 12, 47, 56, 608261)

--
messages: 387266
nosy: xirdneh
priority: normal
severity: normal
status: open
title: get_type_hints evaluates class variables before type hints
type: behavior
versions: 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



[issue18163] Add a 'key' attribute to KeyError

2021-02-18 Thread Andre Roberge


Change by Andre Roberge :


--
nosy: +aroberge

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread John Paul Adrian Glaubitz


John Paul Adrian Glaubitz  added the comment:

> But I don't see the benefit of annoying and discouraging users who want to 
> experiment with Python and with Linux on Z in 31 bit mode.

Fully agree.

> Yes, maintenance theoretically is a burden, but there have been no recent 
> issues that were specific to Linux on Z in 31 bit mode.

As I have mentioned before, the Python interpreter in general has been very 
very unproblematic on any platform. The only real issue that I am aware of is 
that the testsuite can get stuck on machines with a large number of CPUs (we're 
seeing that on our SPARC T5 in Debian).

> In fact, most of the original Linux on Z support issues that I opened were 
> endianness issues, which aren't ameliorated by removing 31 bit support.

And there is still MIPS-BE, PPC-BE, M68k, HPPA among other which are all 
big-endian.

> As others have expressed, deprecating 31 bit mode only removes the 
> configuration option with no other code simplification.

Exactly my point. If it removed a considerable amount of code, I would actually 
see a point. But just removing a few lines of autoconf or preprocessor code 
makes no differences from a maintainer's point of view.

> It seems that it would be better to leave the configuration alone until there 
> actually was an unresolved issue that motivated removal.

Jepp, fully agree.

> But I am not aware of any client requirement to continue the support. 

Sure. But free software shouldn't be solely about commercial customers. If 
someone wants to play with Python on the s390 emulator Hercules, for example, 
upstream projects shouldn't be keeping them from doing that.

> Leaving the 31 bit configuration unchanged is more about maintaining good 
> will among the volunteers who are interested in the platform.

Absolutely. And about not limiting choices when there is no technical argument 
for it.

--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Boštjan Mejak

Boštjan Mejak  added the comment:

The spaceship operator is kinda cool! :)

Well, I was hoping to avoid importing the math module just to have ceil 
division capabilities.

Anyway, my need for ceiling is that I am coding a chess GUI where I have a 
table with 2 columns and I create a new row whenever White makes a move. So, my 
implementation for row creation is math.ceil(len(moves) // 2) where moves is a 
list of chess moves. 

So, the sequence of table rows after White and Black make their moves is 
initially 0 (since there are no moves yet) and then 1 (first row created after 
White made a move) and then 1 (again on row 1 after Black made a move, but on 
column 2), then 2 2 3 3 4 4 5 5 6 6 and so on.

If we had the ceil operator in Python, I could do: len(moves) /// 2 :)

By the way -- do you happen to know any better idea to get that kind of a 
sequence? That is 0 1 1 2 2 3 3 4 4 5 5 6 6 and so on.

--

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread Matej Cepl

Matej Cepl  added the comment:

> Do you actually know someone who is actively interested in the usecase of 
> building a 32 bit python on an s390x system? Or do you know someone who owns 
> an s390 system?

Well, yes, I have just got it confirmed from our PM, SUSE has living and 
breathing (and what’s even more interesting, paying) clients using SLE-12 on 
s390 (i.e., s390x kernel with 32bit libraries). Of course, it doesn’t mean they 
are eager to run Python 3.10 in such configuration (how do you call such 
package? python3a so that “python3a” > “python39”?), we will have to evaluate 
with them what are their plans in the post-36 world with the modern Python 
there.

--

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread David Edelsohn


David Edelsohn  added the comment:

Victor: https://en.wikipedia.org/wiki/31-bit_computing :-)

--

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread David Edelsohn


David Edelsohn  added the comment:

I am not aware of significant use of 31 bit mode.

But I don't see the benefit of annoying and discouraging users who want to 
experiment with Python and with Linux on Z in 31 bit mode.  Yes, maintenance 
theoretically is a burden, but there have been no recent issues that were 
specific to Linux on Z in 31 bit mode.  In fact, most of the original Linux on 
Z support issues that I opened were endianness issues, which aren't ameliorated 
by removing 31 bit support.  As others have expressed, deprecating 31 bit mode 
only removes the configuration option with no other code simplification.

It seems that it would be better to leave the configuration alone until there 
actually was an unresolved issue that motivated removal.  But I am not aware of 
any client requirement to continue the support.  Leaving the 31 bit 
configuration unchanged is more about maintaining good will among the 
volunteers who are interested in the platform.

--

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 44085a3fc9a150478aec1872dd1079c60dcc42f6 by Victor Stinner in 
branch 'master':
bpo-42990: Refactor _PyFrame_New_NoTrack() (GH-24566)
https://github.com/python/cpython/commit/44085a3fc9a150478aec1872dd1079c60dcc42f6


--

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2021-02-18 Thread Gilles Duboscq


Gilles Duboscq  added the comment:

Thanks Victor we'll look into moving away from this pattern.

--

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure why people insists to say that it's 31 bit CPU, gcc-s390.txt shows 
that it uses a classic 32-bit ABI (32-bit long/size_t):

#define __SIZE_MAX__ 0xUL
#define __LONG_WIDTH__ 32

31-bit is a limit of the address space (memory), not the ALU.

--

___
Python tracker 

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



[issue42686] include built-in Math functions in SQLite to 3.35.0 of march 2021

2021-02-18 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

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



[issue18163] Add a 'key' attribute to KeyError

2021-02-18 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> For us it happens when using multiprocessing: the main process forks 2 
> processes and both use urlopen at roughly the same time. We are seeing this 
> on Python 3.7.2 on macOS 10.14.3.

>From what I understood, calling fork() (and then continue to execute regular 
>Python code) is no longer safe in macOS 10.14 and must no longer be used. Only 
>fork+exec is safe (spawn a new child process), but posix_spawn() is preferred 
>on macOS. But I'm not a macOS expert.

--

___
Python tracker 

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



[issue43115] locale.getlocale fails if locale is set

2021-02-18 Thread Eryk Sun


Eryk Sun  added the comment:

> The APIs were written at a time where locale modifiers 
> simply did mot exist. 

Technically, locale modifiers did exist circa 2000, but I suppose you mean that 
they were uncommon to the point of being unheard of at the time.

The modifier field was specified in the X/Open Portability Guide Issue 3 (XPG3) 
in 1989, and again in XPG4 in 1992 as 
"language[_territory][.codeset][@modifier]". I can't provide links to the 
specifications (they're not freely available), but here's a link to X/Open 
"Internationalisation Guide Version 2" (1993), which defines the modifier field 
in section 5.1.2 (pages 88-89):

https://pubs.opengroup.org/onlinepubs/009269599/toc.pdf

> Support could be added via a special locale tuple return
> object, which looks like 2-tuple, but comes with extra attributes
> to store the modifier

That's a good idea and worth implementing. But the _strptime and calendar 
modules have no need to call getlocale(LC_TIME). IMO, it adds fragility for no 
benefit. All they need to save is the result of setlocale(LC_TIME). 

Also, the default locale for calendar.LocaleTextCalendar has no need to use 
getdefaultlocale() instead of using an empty string, i.e. setlocale(LC_TIME, 
""). The latter is simpler and more reliable.

---

> support for Windows is only partial, due to the
> completely different approach Windows' CRT took to locales.

Using the same implementation for POSIX and Windows is needlessly complicated, 
and difficult to reason about how it behaves in all cases.

I suggest implementing separate versions of normalize() and _parse_localename() 
for Windows, making use of direct queries via _winapi.GetLocaleInfoEx() (to be 
added). 

The mapping in encodings.aliases also needs comprehensive coverage for Windows 
code pages (e.g. cp20127 -> ascii, cp28591 -> latin_1, etc). A poor match 
should not be aliased, such as code page 20932 and euc_JP. (For all 3-byte 
sequences in standard euc-JP, code page 20932 encodes 2-byte sequences by 
dropping the lead byte and masking the third byte as ASCII.)

If the locale string doesn't include a codeset, then normalize() shouldn't do 
anything to obtain one. It's not necessary in Windows. If there's a codeset, 
normalize() should ensure it's "UTF-8", "OCP", "ACP", or a Windows code page in 
the right form, e.g. "ascii" -> "20127". ucrt supports "ACP" and "OCP" codesets 
for the locale's ANSI and OEM code pages. These must be in uppercase, e.g. 
"hindi.acp" -> "hindi.ACP". ucrt will set the latter as "Hindi_India.utf8" 
(it's a Unicode-only locale), which should parse as ("Hindi_India", "UTF-8").

If the locale without the codeset isn't a valid Windows BCP-47 locale name, as 
determined by the NLS API, then normalize() should only care about 
case-insensitive normalization of "C" and "POSIX" as "C", e.g. "c" -> "C". No 
other normalization is necessary. ucrt supports case-insensitive 
"language[_country[.codepage]]" and ".codepage" forms, where language and 
country are either the full English names, LOCALE_SENGLISHLANGUAGENAME and 
LOCALE_SENGLISHCOUNTRYNAME, or 3-letter abbreviations, LOCALE_SABBREVLANGNAME 
and LOCALE_SABBREVCTRYNAME, such as "enu_USA". It also supports locale aliases 
such as "american[.codeset]". If the result isn't "C" or a BCP-47 locale name, 
ucrt setlocale() always returns the "language_country.codepage" form with full 
English names.

A BCP-47 locale name such as "en" or "en_US" cannot be used with a codeset 
other than UTF-8. If no codeset is specified, ucrt implicitly uses the locale's 
ANSI code page. 

If a BCP-47 locale name is paired with a codeset that's neither the given 
locale's ANSI codepage nor UTF-8, then normalize it to the 
"language_country.codepage" form. For example, "fr_FR.latin-1" -> 
"French_France.28591". Parse the latter as ("French_France", "ISO-8859-1"). 

If a BCP-47 locale name is paired with the locale's ANSI code page, then 
normalize it without the code page, e.g. "sr_Latn_RS.cp1250" -> "sr_Latn_RS". 
Look up the locale's ANSI code page when parsing the latter, e.g. "sr_Latn_RS" 
-> ("sr_Latn_RS", "cp1250"). 

If a BCP-47 locale name is paired with UTF-8, then there isn't much to do other 
than normalize the locale name and encoding name, e.g. "en_us.utf8" -> 
"en_US.UTF-8".

--

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread David Edelsohn


David Edelsohn  added the comment:

gcc -dM -E - < /dev/null

--
Added file: https://bugs.python.org/file49818/gcc-s390x.txt

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread David Edelsohn


David Edelsohn  added the comment:

gcc -m31 -dM -E - < /dev/null

--
Added file: https://bugs.python.org/file49817/gcc-s390.txt

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

Oh wait, I removed that lock:

commit 0de437de6210c2b32b09d6c47a805b23d023bd59
Author: Victor Stinner 
Date:   Thu May 28 17:23:39 2020 +0200

bpo-25920: Remove socket.getaddrinfo() lock on macOS (GH-20177)

On macOS, socket.getaddrinfo() no longer uses an internal lock to
prevent race conditions when calling getaddrinfo(). getaddrinfo is
thread-safe is macOS 10.5, whereas Python 3.9 requires macOS 10.6 or
newer.

The lock was also used on FreeBSD older than 5.3, OpenBSD older than
201311 and NetBSD older than 4.

Please open a new issue specific to macOS: specify your macOS version, your 
Python version and how you installed or built Python.

--

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue2142] difflib.unified_diff(...) produces invalid patches

2021-02-18 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy:  -mark.dickinson

___
Python tracker 

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



[issue13433] [doc] Improve string format documentation regarding %g

2021-02-18 Thread Mark Dickinson


Mark Dickinson  added the comment:

Closing; the documentation was updated recently. See #39096 for details.

--
resolution:  -> fixed
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



[issue42429] Behavior of general (%g, :g) formatting inconsistent for decimal.Decimal

2021-02-18 Thread Mark Dickinson


Mark Dickinson  added the comment:

The documentation did get updates: see #39096 for details. Closing here.

--
resolution:  -> not a bug
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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Mark Dickinson


Change by Mark Dickinson :


--
resolution: not a bug -> rejected

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2021-02-18 Thread Gilles Duboscq


Gilles Duboscq  added the comment:

I get '0' so it was not built with HAVE_GETHOSTBYNAME_R.

--

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

"Segmentation fault with (...) threads (...) getaddrinfo"

Aha, another victim on a getaddrinfo() implementation which is not thread safe.

See this code in Modules/socketmodule.c:

/* Lock to allow python interpreter to continue, but only allow one
   thread to be in gethostbyname or getaddrinfo */
#if defined(USE_GETHOSTBYNAME_LOCK)
static PyThread_type_lock netdb_lock;
#endif

Can you please check if your Python was built with HAVE_GETHOSTBYNAME_R?

$ python3
Python 3.9.1 (default, Jan 20 2021, 00:00:00) 
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
>>> import sysconfig; repr(sysconfig.get_config_var('HAVE_GETHOSTBYNAME_R'))
'1'


Modules/socketmodule.c is full of #ifdef involving macOS...

--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Mark Dickinson


Mark Dickinson  added the comment:

I can't recall where I saw this originally, but you can use the spaceship 
operator "--0--" to turn floor division into ceiling division:

>>> 12//5
2
>>> --0-- 12//5
3

There's also the ++0++ operator when you want to emphasize that you really *do* 
mean floor division:

>>> ++0++ 12//5
2

But yes, -(-n // d) is the easy (if a little bit cryptic) way to get the 
ceiling of n / d.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Berker Peksag


Change by Berker Peksag :


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



[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset cc96231f0a59cc7393943064800ecb6c18892662 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43249: Improve scoping in _pysqlite_fetch_one_row() (GH-24565)
https://github.com/python/cpython/commit/cc96231f0a59cc7393943064800ecb6c18892662


--

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2021-02-18 Thread Gilles Duboscq


Gilles Duboscq  added the comment:

I'm not sure it's the same but we have seen stack traces looking like the one 
there: https://github.com/astropy/astropy/issues/9699

Current thread 0x7fffa857e3c0 (most recent call first):
  File "/sw/lib/python3.7/socket.py", line 748 in getaddrinfo
  File "/sw/lib/python3.7/socket.py", line 707 in create_connection
  File "/sw/lib/python3.7/http/client.py", line 938 in connect
  File "/sw/lib/python3.7/http/client.py", line 966 in send
  File "/sw/lib/python3.7/http/client.py", line 1026 in _send_output
  File "/sw/lib/python3.7/http/client.py", line 1247 in endheaders
  File "/sw/lib/python3.7/http/client.py", line 1298 in _send_request
  File "/sw/lib/python3.7/http/client.py", line 1252 in request

For us it happens when using multiprocessing: the main process forks 2 
processes and both use urlopen at roughly the same time. We are seeing this on 
Python 3.7.2 on macOS 10.14.3.

--
nosy: +gilles-duboscq

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> You say it's on purpose, what's the purpose? Aren't you worried this is going 
> to break stuff?

There is a subtle behavior difference between Python 3.9 and Python 3.10. 
func_builtins2.py of bpo-43228 works on Python 3.9 but fails on Python 3.10. 
With my PR 24564, func_builtins2.py works again on Python 3.10.

See bpo-43228 for the details.

> And why is this necessary given the LOAD_GLOBAL cache?

My PR 24564 is not related to LOAD_GLOBAL, but how a frame fills its f_builtins 
member from a function.

LOAD_GLOBAL uses f_globals and f_builtins members of a frame.

--

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

Victor
> the new globals has no "__builtins__" key. This change is backward 
> incompatible on purpose. If someone really wants to run a function in a 
> different builtins namespace, globals['__builtins__'] must be set explicitly.

You say it's on purpose, what's the purpose? Aren't you worried this is going 
to break stuff? And why is this necessary given the LOAD_GLOBAL cache?

Yury
> this hypothetical LEN opcode would still have to check if "len" was shadowed 
> or not, and that's slower than the optimized LOAD_GLOBAL we have now.

It could use the same check though? Just check the version tags.

--

___
Python tracker 

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



[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +23346
pull_request: https://github.com/python/cpython/pull/24565

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread Yury Selivanov


Yury Selivanov  added the comment:

> So you think that even a dedicated "LEN" opcode would not be any faster? 
> (This is getting in Paul Sokolovsky territory -- IIRC he has a variant of 
> Python that doesn't allow overriding builtins.)

Yeah, a dedicated LEN opcode could only be faster if it would not be possible 
to shadow builtins (or if there was a "len" operator in Python).  If that's not 
the case, this hypothetical LEN opcode would still have to check if "len" was 
shadowed or not, and that's slower than the optimized LOAD_GLOBAL we have now.

--

___
Python tracker 

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



[issue28429] ctypes fails to import with grsecurity's TPE

2021-02-18 Thread Petr Viktorin


Petr Viktorin  added the comment:

Glandos, thank you for the report and fix, and apologies that it wasn't seen by 
the right set of eyes.

--
nosy: +petr.viktorin
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



[issue43253] asyncio open_connection fails when a socket is explicitly closed

2021-02-18 Thread Emmanuel Arias


Change by Emmanuel Arias :


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

___
Python tracker 

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



[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 47feb1feb28631b6647699b7633109aa85340966 by Erlend Egeberg 
Aasland in branch 'master':
bpo-43249: sqlite3_column_bytes() must follow sqlite_column_blob() (GH-24562)
https://github.com/python/cpython/commit/47feb1feb28631b6647699b7633109aa85340966


--

___
Python tracker 

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



[issue42960] resources module, FreeBSD update adding RLIMIT_KQUEUES constant

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks David, I merged your PR.

--
resolution:  -> fixed
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



[issue42960] resources module, FreeBSD update adding RLIMIT_KQUEUES constant

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7be00ee64a2ced73c00ec855c7265e2ba795213d by David CARLIER in 
branch 'master':
bpo-42960: Add resource.RLIMIT_KQUEUES constant from FreeBSD (GH-24251)
https://github.com/python/cpython/commit/7be00ee64a2ced73c00ec855c7265e2ba795213d


--
nosy: +vstinner

___
Python tracker 

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



[issue43253] asyncio open_connection fails when a socket is explicitly closed

2021-02-18 Thread Daniel Engel


Daniel Engel  added the comment:

It reproduced on a windows machine

--

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not convinced that this operation is so common that it deserves a new 
operator. As Serhiy wrote, it must be first on python-ideas first. I close the 
issue.

--

floor division is x//y

integer ceil division can be implemented with math.ceil(x/y) for small numbers.

For large integer numbers, I like to use something like:

def ceil_div(x, y):
rem=x % y
if rem:
x += y - rem
return x//y

I let you adjust it for negative numbers ;-)

--
nosy: +vstinner
resolution:  -> not a bug
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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since adding new operator is a syntax-level change, it needs a PEP. It is 
better to start with discussing on the Python-ideas mailing list 
(https://mail.python.org/mailman3/lists/python-ideas.python.org/). Let's see if 
this idea will be accepted favorably.

BTW, the ceiling division can be expressed as -(-a // b) or -(a // -b).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43253] asyncio open_connection fails when a socket is explicitly closed

2021-02-18 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

I cannot reproduce on a Debian machine. Seems to be a Windows component issue?

--
nosy: +eamanu

___
Python tracker 

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



[issue43256] Document that PyErr_SetInterrupt is async-signal-safe

2021-02-18 Thread Antoine Pitrou


New submission from Antoine Pitrou :

While this makes sense given the exposed functionality, the reader may be wary 
of calling PyErr_SetInterrupt from a C signal handler if it's not explicitly 
documented as signal-safe.

--
assignee: docs@python
components: C API, Documentation
messages: 387234
nosy: docs@python, pablogsal, pitrou, vstinner
priority: low
severity: normal
status: open
title: Document that PyErr_SetInterrupt is async-signal-safe
type: behavior
versions: Python 3.10, 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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
versions: +Python 3.10

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

I reopen the issue since there is bpo-43228 regression, caused by this issue, 
which is still under discussion, and Mark also proposed to add a new builtins 
parameter to the function constructor (FunctionType).

I wrote PR 24564 to help fixing bpo-43228 regression: with this change, 
functions now inherit the current builtins if the globals namespace is 
overriden, but the new globals has no "__builtins__" key. This change is 
backward incompatible on purpose. If someone really wants to run a function in 
a different builtins namespace, globals['__builtins__'] must be set explicitly.

Once PR 24564 will be merged, I plan to write a 3rd PR to add an optional 
builtins keyword-only parameter to the function constructor (FunctionType).

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

___
Python tracker 

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



[issue43228] Regression in function builtins

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

I proposed PR 24564: "bpo-42990: Functions inherit current builtins" which 
should also to fix cloudpickle.

--

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23345
pull_request: https://github.com/python/cpython/pull/24564

___
Python tracker 

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



[issue43255] Ceil division with /// operator

2021-02-18 Thread Boštjan Mejak

New submission from Boštjan Mejak :

I hope I'm not too late for a Python 3.10 feature request. I love the fact that 
Python 3.x does floor division with the // operator.

We, however, don't have a ceil division operator, besides importing the math 
module and using its math.ceil() function.

Is it possible we have /// as a ceil division operator in Python 3.10?

I just wanted to put this thought out of my head if anyone becomes entertained 
by this idea.

--
components: Library (Lib)
messages: 387231
nosy: PedanticHacker, gvanrossum, rhettinger
priority: normal
severity: normal
status: open
title: Ceil division with /// operator
type: enhancement
versions: Python 3.10

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue43254] Fix *snprintf() man page links

2021-02-18 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Both snprintf and vsnprintf belong to man section 3 (library functions), not 
section 2 (system calls).

Affected doc page: https://docs.python.org/3.10/c-api/conversion.html

--
assignee: docs@python
components: Documentation
messages: 387230
nosy: docs@python, erlendaasland
priority: normal
severity: normal
status: open
title: Fix *snprintf() man page links
versions: Python 3.10, 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



[issue40077] Convert static types to heap types: use PyType_FromSpec()

2021-02-18 Thread Nicholas Sim


Change by Nicholas Sim :


--
nosy: +nw0

___
Python tracker 

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



[issue29086] Document C API that is not part of the limited API

2021-02-18 Thread Petr Viktorin


Petr Viktorin  added the comment:

PEP 652 is currently draft & it's discussed at 
https://discuss.python.org/t/pep-652-maintaining-the-stable-abi/6986

--

___
Python tracker 

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



[issue43253] asyncio open_connection fails when a socket is explicitly closed

2021-02-18 Thread Daniel Engel


New submission from Daniel Engel :

Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit 
(AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.18.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import socket
   ...: s1, s2 = socket.socketpair()
   ...: import asyncio
   ...: async def test():
   ...: r1, w1 = await asyncio.open_connection(sock=s1)
   ...: r2, w2 = await asyncio.open_connection(sock=s2)
   ...: s1.close()
   ...: asyncio.run(test())
Exception in callback 
_ProactorBasePipeTransport._call_connection_lost(ConnectionAbo...e, 1236, None))
handle: 
Traceback (most recent call last):
  File "c:\python39\lib\asyncio\events.py", line 80, in _run
self._context.run(self._callback, *self._args)
  File "c:\python39\lib\asyncio\proactor_events.py", line 162, in 
_call_connection_lost
self._sock.shutdown(socket.SHUT_RDWR)
OSError: [WinError 10038] An operation was attempted on something that is not a 
socket

--
components: asyncio
messages: 387228
nosy: asvetlov, danielen1337, yselivanov
priority: normal
severity: normal
status: open
title: asyncio open_connection fails when a socket is explicitly closed
versions: Python 3.9

___
Python tracker 

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



[issue29086] Document C API that is not part of the limited API

2021-02-18 Thread Nicholas Sim


Change by Nicholas Sim :


--
nosy: +nw0

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2021-02-18 Thread Nicholas Sim


Change by Nicholas Sim :


--
nosy: +nw0

___
Python tracker 

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



[issue38822] Inconsistent os.stat behavior for directory with Access Denied

2021-02-18 Thread Nicholas Sim


Change by Nicholas Sim :


--
nosy: +nw0

___
Python tracker 

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



[issue43179] Remove 31/32-bit s390 Linux support (s390-linux-gnu triplet)

2021-02-18 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

> You do not need to support every platform. Just allow your users to use them.

This is kinda missing the point though. For example I've dealt a lot with the 
CPython codebase (and I'm also one of the Red Hat maintainers for RHEL and 
Fedora) and although I'm not a core developer, the codebase can be quite 
intimidating.

I agree that some lines of code do not seem like much but they add up. If noone 
actually has a use case here, removing them would be the best option overall 
just from a cognitive perspective.

Now I agree there are hobbyist's and so forth but you present an example, which 
is irrelevant to this case (m68k is not s390, right?). Do you actually know 
someone who is actively interested in the usecase of building a 32 bit python 
on an s390x system? Or do you know someone who owns an s390 system? Maybe 
someone who sends related fixes to another project?

You claim to speak for other maintainers, yet I'd like to actually hear their 
position on that. Feel free to add them to the nosy list. If the latest kernel 
is not even booting, I don't think many people actually care about this arch to 
at least keep it running.

On the other hand I do think though here that David would be the best person to 
speak about those use cases, as he is the most experienced here with the 
s390(x) architecture.

Now from my personal point of view, I don't mind actually keeping the support 
there, but it will never come up downstream for me, hence it won't affect me as 
Fedora doesn't build anymore for s390 (and already posted before the case for 
RHEL).

So again, do you know of this specific usecase, of someone either owning an 
s390 machine and compiling python, or actually utilizing an s390x machine and 
using the multilib packages to build a 32 bit python? If so, would you (or 
they) step up to fix related issues when they come up and assuming a buildbot 
would be set? Or would you know someone who would?

While your arguments make sense up to a point, claiming that others will step 
up or saying what others have done for different architectures, doesn't really 
help your arguments to hold.

--

___
Python tracker 

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



[issue43252] deepcopy of weakref proxies

2021-02-18 Thread Konrad Schwarz


New submission from Konrad Schwarz :

copy.deepcopy()-ing a tree structure that has internal parent and 
cross-reference links implemented as weakref.proxy() objects causes the weak 
reference proxies themselves to be copied (still refering to their original 
referents) rather than weak references to deep-copied referents to be created.

A workaround is to add the following __deepcopy__ method to affected classes:
def __deepcopy__ (self, memo):
# taken from Stackoverflow: "How to override the
# copy deepcopy operations for a python object"
# and "Python: dereferencing weakproxy"
cls = self.__class__
result = cls.__new__ (cls)
memo [id (self)] = result
for k, v in self.__dict__.items ():
if isinstance (v, weakref.ProxyType):
new_v = weakref.proxy (copy.deepcopy (
v.__repr__.__self__, memo))
else:
new_v = copy.deepcopy (v, memo)
setattr (result, k, new_v)
return result

--
components: Library (Lib)
messages: 387226
nosy: konrad.schwarz
priority: normal
severity: normal
status: open
title: deepcopy of weakref proxies
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue43250] [C API] Depreate or remove PyFPE_START_PROTECT() and PyFPE_END_PROTECT()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

Using INADA-san recipe 
https://github.com/methane/notes/tree/master/2020/wchar-cache I found the 62 
projects on the PyPI top 4000 which contain "PyFPE" pattern:

asyncpg-0.22.0.tar.gz
auditwheel-3.3.1.tar.gz
av-8.0.3.tar.gz
bcolz-1.2.1.tar.gz
BDQuaternions-0.2.15.tar.gz
bx-python-0.8.9.tar.gz
ConfigSpace-0.4.18.tar.gz
Cython-0.29.21.tar.gz
cytoolz-0.11.0.tar.gz
ddtrace-0.46.0.tar.gz
dedupe-hcluster-0.3.8.tar.gz
dependency-injector-4.23.5.tar.gz
fastavro-1.3.2.tar.gz
fastdtw-0.3.4.tar.gz
Fiona-1.8.18.tar.gz
fuzzysearch-0.7.3.tar.gz
fuzzyset-0.0.19.tar.gz
gensim-3.8.3.tar.gz
grpcio-1.35.0.tar.gz
gssapi-1.6.12.tar.gz
hdbscan-0.8.27.tar.gz
hmmlearn-0.2.5.tar.gz
imagecodecs-2021.1.28.tar.gz
implicit-0.4.4.tar.gz
lightfm-1.16.tar.gz
lupa-1.9.tar.gz
lxml-4.6.2.tar.gz
mujoco-py-2.0.2.13.tar.gz
neobolt-1.7.17.tar.gz
orderedset-2.0.3.tar.gz
peewee-3.14.1.tar.gz
Pillow-8.1.0.tar.gz
Pillow-SIMD-7.0.0.post3.tar.gz
pmdarima-1.8.0.tar.gz
pomegranate-0.14.2.tar.gz
pycapnp-1.0.0.tar.gz
pydevd-2.2.0.tar.gz
pygame-2.0.1.tar.gz
pyhacrf-datamade-0.2.5.tar.gz
pyjq-2.5.1.tar.gz
pysam-0.16.0.1.tar.gz
pystan-2.19.1.1.tar.gz
PyWavelets-1.1.1.tar.gz
rasterio-1.2.0.tar.gz
ruptures-1.1.3.tar.gz
s2sphere-0.2.5.tar.gz
scikit-image-0.18.1.tar.gz
scipy-1.6.1.tar.gz
Shapely-1.7.1.tar.gz
simplejson-3.17.2.tar.gz
spacy-3.0.3.tar.gz
statsmodels-0.12.2.tar.gz
tables-3.6.1.tar.gz
Theano-1.0.5.tar.gz
thinc-8.0.1.tar.gz
tinycss-0.4.tar.gz
tslearn-0.5.0.5.tar.gz
uvloop-0.15.1.tar.gz
weighted_levenshtein-0.2.1.tar.gz
wordcloud-1.8.1.tar.gz
wsaccel-0.6.3.tar.gz
wxPython-4.1.1.tar.gz


Example with asyncpg:

$ rg PyFPE
asyncpg/pgproto/pgproto.c
39841:PyFPE_START_PROTECT("add", return NULL)
39843:PyFPE_END_PROTECT(result)

asyncpg/protocol/protocol.c
85260:PyFPE_START_PROTECT("add", return NULL)
85262:PyFPE_END_PROTECT(result)
85563:PyFPE_START_PROTECT("subtract", return NULL)
85565:PyFPE_END_PROTECT(result)
85734:PyFPE_START_PROTECT("add", return NULL)
85736:PyFPE_END_PROTECT(result)


So it doesn't sound like a good idea to immediately remove these two macros.

--

___
Python tracker 

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



[issue15108] Incomplete tuple created by PyTuple_New() and accessed via the GC can trigged a crash

2021-02-18 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Should we still fix sqlite3, or wait for an agreement on GH-24510?

I suggest to let's all agree on how to fix this on the bigger scale first.

--

___
Python tracker 

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



[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue42990] Improve the C code for calling Python code: _PyEval_EvalCode()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a3c3ffa68e6fc4524b1149a6a14d56c3a2e9b612 by Victor Stinner in 
branch 'master':
bpo-42990: Add __builtins__ attribute to functions (GH-24559)
https://github.com/python/cpython/commit/a3c3ffa68e6fc4524b1149a6a14d56c3a2e9b612


--

___
Python tracker 

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



[issue43228] Regression in function builtins

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

> but __builtins__.__dict__ cannot be pickled.

I don't see why cloudpickle calls LambdaType() directly. It could use a helper 
in their cloudpickle.cloudpickle_fast which calls LambdaType() with the proper 
arguments, especially to get __builtins__. I don't think that cloudpickle 
should serialize __builtins__!

By the way, I'm not sure why the function constructor builds {'None': None} 
namespace for builtins rather than inheriting the current builtins namespace. 
IMO it's unconvenient.

If someone wants to override __builtins__, setting __builtins__ key in the 
globals namespace should be enough.

> Adding a "builtins" parameter to types.FunctionType() should be be enough.

Oh right, we should give the ability to control this important parameter!

--

___
Python tracker 

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



[issue43249] sqlite3_column_bytes() should be called after sqlite3_column_blob()

2021-02-18 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

> Sounds good to me but I'd say designing APIs relying on call order is bad too 
> :)

Yes, it's too easy to mess up things with this part of the SQLite API :) I'll 
throw up a PR.


BTW (small digression):
I really want to refactor _pysqlite_fetch_one_row() so it uses two helpers (for 
example _fetch_nth_column_with_converter() and _fetch_nth_column()). It will be 
easier to maintain, and it's way easier to read. The coverage for this function 
is close to 100%, so it should be pretty safe to refactor it.

--

___
Python tracker 

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



[issue43250] [C API] Depreate or remove PyFPE_START_PROTECT() and PyFPE_END_PROTECT()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-38835: "pyfpe.h: Exclude PyFPE_START_PROTECT and PyFPE_END_PROTECT 
from the Py_LIMITED_API".

--

___
Python tracker 

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



[issue43250] [C API] Depreate or remove PyFPE_START_PROTECT() and PyFPE_END_PROTECT()

2021-02-18 Thread STINNER Victor


STINNER Victor  added the comment:

I explicitly excluded the PyFPE macros from the limited C API in Python 3.9:

commit 488d02a24142948bfb1fafd19fa48e61fcbbabc5
Author: Victor Stinner 
Date:   Wed Nov 20 12:17:09 2019 +0100

bpo-38835: Exclude PyFPE macros from the stable API (GH-17228)

Exclude PyFPE_START_PROTECT() and PyFPE_END_PROTECT() macros of
pyfpe.h from Py_LIMITED_API (stable API).

--

___
Python tracker 

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



  1   2   >