[issue42888] Not installed “libgcc_s.so.1” causes parser crash.

2021-01-10 Thread Christian Heimes


Christian Heimes  added the comment:

What's your platform and distribution?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue42889] Incorrect behavior of Python parser after ast node of test program being modified

2021-01-10 Thread Xinmeng Xia


New submission from Xinmeng Xia :

The following program will lead to a incorrect behavior of Python parser.  We 
change all variable to integer( forcely transformed to string) via 
ast.NodeTransformer. Then we compile the new code and execute it. It's 
surprising that code like "1=2; print(1)" can be compiled without error 
message. And more surprisingly, the execution result of "print(1)" is 2 ! !


import ast
class RewriteName(ast.NodeTransformer):
def visit_Name(self, node):
if node.id != "print":
node.id = str(node.lineno)
return node


code = "a = 2;print(a)"


myast = ast.parse(code)
transformer = RewriteName()
newast = transformer.visit(myast)

# print(ast.dump(newast))

print("new code:","")
print(ast.unparse(newast))
print("")

c = compile(newast,'','exec')
exec(c)
=

output result:
new code: 
1 = 2
print(1)

2

Expected result: (1). Syntax error during compilation. "1" should not be the 
correct identifier of program, even if it's forcely transformed to string. (2). 
The output of execution should be "1"  , since the parameter of "print()" in 
the new code is string "1".  

This incorrect behaviors exists on all version of Python(from Python2 to Python 
3).

--
components: Interpreter Core
messages: 384799
nosy: xxm
priority: normal
severity: normal
status: open
title: Incorrect behavior of Python parser after ast node of test program  
being modified
type: behavior
versions: Python 3.10, Python 3.6, 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



[issue42888] Not installed “libgcc_s.so.1” causes parser crash.

2021-01-10 Thread Xinmeng Xia

New submission from Xinmeng Xia :

The following thread program will cause Python3.10 parser "core dump" due to 
missing “libgcc_s.so.1”. "pthread_cancel" cannot work correctly. I am wondering 
is there any possible to install or link to libgcc_s.so.1 during Python 
installation?

===
import socket
from threading import Thread
class thread(Thread):
  def run(self):
  for res in socket.getaddrinfo('www.google.com',8080):
  sock = socket.socket()
  sock.connect(res[4])

for i in range(2000):
thread().start()

Error message:
---

Exception in thread Thread-1346:
Traceback (most recent call last):
  File "/usr/local/python310/lib/python3.10/threading.py", line 960, in 
_bootstrap_inner
  File "/usr/local/python310/lib/python3.10/threading.py", line 960, in 
_bootstrap_inner
Exception in thread Thread-1172:
Traceback (most recent call last):
...
Exception in thread Thread-1509:
Exception in thread Thread-1510:
libgcc_s.so.1 must be installed for pthread_cancel to work
Exception in thread Thread-1511:
Traceback (most recent call last):
Aborted (core dumped)
---

--
components: Interpreter Core
messages: 384798
nosy: xxm
priority: normal
severity: normal
status: open
title: Not installed “libgcc_s.so.1” causes parser crash.
type: crash
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



[issue42887] Multiple assignments of attribute "__sizeof__" will cause a segfault

2021-01-10 Thread Xinmeng Xia

New submission from Xinmeng Xia :

In the following program 1, method  "__sizeof__()" is called and assigned 
multiple times. The program can work well on Python 3.10. However if I change 
"__sizeof__()" to  "__sizeof__".  Then a segmentation fault is reported. I 
think something wrong for the parser when dealing build-in attribute assignment.



program 1: 
=
mystr  = "hello123"
for x in range(100):
mystr = mystr.__sizeof__()
print(mystr)
=
56
28
28
...
28
28

Output: work well as expected.


program 2: 
==
mystr = "hello123"
for x in range(100):
mystr = mystr.__sizeof__
print(mystr)
==

..


Segmentation fault (core dumped)

Expected output: no segfault.

--
components: Interpreter Core
messages: 384797
nosy: xxm
priority: normal
severity: normal
status: open
title: Multiple assignments of attribute "__sizeof__" will cause a segfault
type: crash
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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ziqiao Kong


Ziqiao Kong  added the comment:

BTW, uname for the M1 MBP.

```
kabeor@kamino cpython-3.10.0a4 % uname -a
Darwin kamino.lan 20.1.0 Darwin Kernel Version 20.1.0: Sat Oct 31 00:07:10 PDT 
2020; root:xnu-7195.50.7~2/RELEASE_ARM64_T8101 arm6464
```

--

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ziqiao Kong


Ziqiao Kong  added the comment:

Seems that we are getting the same libffi.dylib.

kabeor@kamino cpython-3.10.0a4 % otool -L $(./python.exe -c 'import 
_ctypes;print(_ctypes.__file__)')
/Users/kabeor/cpython-3.10.0a4/build/lib.macosx-11.0-arm64-3.10/_ctypes.cpython-310-darwin.so:
/usr/lib/libffi.dylib (compatibility version 1.0.0, current version 
27.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1292.60.1)

--

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

The problem with that formulation of the feature request is that it would 
require the math.log function to recognize rationals, or at least the Fraction 
type. Since the numeric tower and the fractions module are implemented in pure 
Python that would be somewhat problematic.

I think people who work a lot with fractions and want to compute their 
logarithm just need to use the formula that the OP gave.

--
resolution:  -> wont fix
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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Any principled change costs more than it's worth :-(

For anyone wanting to go forward with this, here's a summary of the feature 
request:

Given two non-zero same signed integers x and y,
log10(Fraction(x, y)) does the same as log10(x / y).

This works well unless the ratio of x to y is outside
the range supported by floats.

What is desired is that for extreme values of x and y,
that log10() will treat the fraction differently and
compute log10(x) - log10(y) instead of log10(x / y).

--

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Tim Peters


Tim Peters  added the comment:

Any principled change costs more than it's worth :-(

I'm mostly sympathetic with Guido's view, and have long advocated a new `imath` 
module to hold the ever-growing number of functions that are really part of 
integer combinatorics.  But it's become nearly impossible to add a new module 
anymore:  python-ideas can't maintain any focus, python-dev has become an 
eternal circular debating society, and "put it on pyPI first to see whether 
it's adopted" has become a go-to bait-&-switch scam (e.g., witness Grant 
Jenks's `sortedcontainers` module, which is absolutely first rate, and widely 
used, but "why add it to the core? it's already on pyPI" has shut down any 
suggestion to fold it in - although I don't know that Grant would _want_ to 
fold it in).

OTOH, I don't agree `math` should be limited solely to floats.  It would be, 
e.g., pointlessly annoying for things like `pow(x, 4)` or `atan(1)` to blow up 
just because an argument is an int instead of a float.  I have no problem with 
limiting `math` functions to the simple scalar types that also work in C libm 
calls (where ints aren't a problem because the compiler inserts coercions to 
double). As a slight extension then, I have no problem either with log(1 << 
100) working, because Python doesn't have C's distinctions between integer 
sizes.  So, overall, "floats or ints, but generally just the functions C's 
 defines".  Which is pretty much how `math` started.

But I don't see a realistic way to get there from here. Even though I'm retired 
now, I don't _want_ to spend 16 hours arguing every day for months - that's a 
major percentage of my remaining expected life ;-)

For other approaches, people doing serious work already solve it the obvious 
way. For example, the spiffy arbitrary-precision `mpmath` binary float module 
supplies its own versions of libm functions, that work on the numeric types it 
defines. It's not a real problem in real life that they don't also work on 
Fraction or Decimal. In fact, I'm glad they don't! It would usually be "an 
error" in my code if I tried to pass a Decimal to an mpmath function, because 
I'm using mpmath to begin with precisely because I _intend_ to work 
specifically and only with mpmath's numeric types for the duration.

So we can keep this report open forever waiting for a miracle, or yield to 
reality and close it as "sorry - won't fix" now ;-)

--
nosy: +tim.peters

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> math.log10 works perfectly on integers which are too large
> to be converted to floats. I see no reason why it couldn't 
> work as well with fractions.

This is tricky territory.  Mathematically, a common logarithm can and often 
will have a irrational result, so floats will enter the picture at some point.  
Unlike Fractions which don't have size limits, floats are range limited, so 
some overflows and underflows will still happen regardless. 

> ... but this would be a heavy change.

There's the rub.  We could create a dunder method for every math function and 
require that every numeric type to support every dunder method.

That's a somewhat major design change and it's far above my pay grade to say 
whether that would be worth it ;-)

--

___
Python tracker 

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



[issue42878] urllib.request.HTTPPasswordMgr.is_suburi does not care about order

2021-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

Cheryl, do you have time to review this?

--
nosy: +cheryl.sabella, gvanrossum

___
Python tracker 

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



[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

I agree this is a bit unfortunate, but I also think it's a bit late to change 
now.

However *if* we're going to change it we should do it now (in 3.10) or never. 
Given that we never *write* type(None) in annotations, it's unfortunate to get 
that back whenever we wrote None.

I personally don't care because I never use get_type_hints() -- I don't use 
annotations at runtime (which may also be how this snuck into  get_type_hints() 
in the first place -- some misguided idea that it should return a "type").

--

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Camion


Camion  added the comment:

A generic solution might be to consider all number as fractions (which they 
are) (floats have denominators being 2^n, decimals have denominators being 
10^n, integers have denominators being 1, and fractions have denominators being 
integers... but this would be a heavy change.

--

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Camion


Camion  added the comment:

math.log10 works perfectly on integers which are too large to be converted to 
floats. I see no reason why it couldn't work as well with fractions.

>>> math.log10(math.factorial(1))
35659.45427452078
>>> math.log10(math.factorial(100))
5565708.917186718
>>> math.log10(float(math.factorial(1)))
Traceback (most recent call last):
  File "", line 1, in 
math.log10(float(math.factorial(1)))
OverflowError: int too large to convert to float

--

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Guido van Rossum


Guido van Rossum  added the comment:

I guess another approach might be to change the math module so that all its 
functions support franctions (and decimal, and other esoteric number types). 
But that would require having __log__ and many others as methods on the numeric 
types.

Personally I wish we had kept the math module for C doubles (Python floats) 
only -- I fear that it has become a mash-up of such functions with random other 
things people may remember from their high school math classes such as 
factorial(). This is just asking for misunderstandings like this. :-(

--
nosy: +gvanrossum

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

With a truly minimal but reproducible example, I was able to understand and 
experiment. As is, widget creation is done without the event loop running.  
Displaying the message box shifts grabs the internal focus but also displays 
the unfocused tk window.  When the message box is dismissed and mainloop() is 
called, the root window is displayed apparently with focus but it is 
unresponsive to mouse click on the entry box, hence the entry box never gets 
focus and never gets keypresses.  This is a bug somewhere between tk and 
Windows window manager and focus management.

Adding after_idle delays the message box and entry creation until after the 
mainloop call, and clicking on the entry now works.  In this case, the 
(unfocused) root window is *not* displayed.


If the entry box is the proper default focused widget when the message box is 
dismissed, an even better fix, to me, is to bind the entry box and explicitly 
give it the focus.  According to the tk docs, focus_set should work.  But it 
does not on Windows (and I suspect that this is related to clicking not 
working).  focus_force does work.

Another solution is to add master.update() before createWidgets.  Clicking on 
then works.  Putting self.master.update() after the messagebox call does not 
work.

--

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Internally, the math.log10() function only works on floats.  By way of the 
__float__() method, the input to the the math.log10() function is asked to 
convert itself to a float.  Fractions implement __float__() by just dividing 
the numerator and denominator.  In your example, the result is smaller than the 
smallest representable positive float (2**-1074), so the result gets rounded 
down to 0.0.  The log10() function isn't defined for zero:

>>> f = Fraction(factorial(1), factorial(2)+1)
>>> float(f)
0.0
>>> log10(f)
Traceback (most recent call last):
  ...
ValueError: math domain error

Short of adding a log10() method to the Fraction class, there isn't a straight 
forward way to accommodate getting this to work.

--
nosy: +rhettinger

___
Python tracker 

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



[issue42886] math.log and math.log10 domain error on very large Fractions

2021-01-10 Thread Camion


New submission from Camion :

Python is able to computer the logarithms of very large integers and fractions 
(by using log(num)-log(denom)), However the fractions.Fraction class fails to 
do it and raises a math domain error exception.

>>> import math, fractions
>>> f=fractions.Fraction(math.factorial(1), math.factorial(2)+1)
>>> math.log(f.numerator)-math.log(f.denominator)
-95966.69390038431
>>> math.log(f)
Traceback (most recent call last):
  File "", line 1, in 
math.log(f)
ValueError: math domain error
>>> math.log10(f.numerator)-math.log10(f.denominator)
-41677.80560743537
>>> math.log10(f)
Traceback (most recent call last):
  File "", line 1, in 
math.log10(f)
ValueError: math domain error

--
components: Library (Lib)
messages: 384783
nosy: Camion
priority: normal
severity: normal
status: open
title: math.log and math.log10 domain error on very large Fractions
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



[issue42885] Regex performance problem with ^ aka AT_BEGINNING

2021-01-10 Thread Arnim Rupp


New submission from Arnim Rupp :

The re lib needs 7 seconds to check if a billion As start with an x. So e.g. 
this statement takes this long:

re.search(r'^x', 'A' * 10)

It takes longer, the longer the string is. The string handling is not the 
problem, checking if it starts which an A takes just 0.00014 seconds. See 
output and code below:

3.10.0a4+ (heads/master:d16f617, Jan  9 2021, 13:24:45) 
[GCC 7.5.0]
testing string len:  10
re_test_false:  0.0008246829966083169
testing string len:  10
re_test_false:  7.317708015005337
testing string len:  10
re_test_true:   0.00014710200048284605


import re, timeit, functools, sys

def re_test_true(string):
print("testing string len: ", len(string))
re.search(r'^A', string)

def re_test_false(string):
print("testing string len: ", len(string))
re.search(r'^x', string)

print(sys.version)

huge_string = 'A' * 10
print('re_test_false: ', timeit.timeit(functools.partial(re_test_false, 
huge_string), number=1))

huge_string = 'A' * 10
print('re_test_false: ', timeit.timeit(functools.partial(re_test_false, 
huge_string), number=1))

print('re_test_true:  ', timeit.timeit(functools.partial(re_test_true, 
huge_string), number=1))

--
components: Library (Lib)
files: regex_timeit.py
messages: 384782
nosy: another_try
priority: normal
severity: normal
status: open
title: Regex performance problem with ^ aka AT_BEGINNING
type: performance
versions: Python 3.10
Added file: https://bugs.python.org/file49733/regex_timeit.py

___
Python tracker 

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



[issue42129] Support resources in namespace packages

2021-01-10 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks!

No rush, but ideally soon enough to be merged before the beta release of Python 
3.10 (2021-05-03).

--

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2021-01-10 Thread Roland Hieber


Roland Hieber  added the comment:

Okay, I've had a look at this, and it seems that all the heavy lifting is 
already included in 68669ef7883 (via #38634, PR 16986). The selection of 
libedit vs. readline still needs to be ported. I've prepared (and tested) PR 
24189 for the rebase of this patch to the current master.

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-10 Thread John McCabe


John McCabe  added the comment:

Apologies, I couldn't find an edit button! That last comment should've said:

"As before, changing:

self.createWidgets()

to:

self.after_idle(self.createWidgets)

avoids the issue."

--

___
Python tracker 

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



[issue42867] Entry Widget not editable on Windows 10, but is on Linux Ubuntu 16.04

2021-01-10 Thread John McCabe


John McCabe  added the comment:

Fair point about being "too" long. Having seen a "short" example that, 
unfortunately, didn't actually exhibit the problem, I thought that providing a 
"smallish" example that definitely did exhibit the issue was quicker than, 
potentially, spending more time than necessary cutting it down.

However, for the record, hope the below example is better. As before, changing:

self.createWidgets()

to:

self.after_idle(self.createWidgets())

avoids the issue.

-
#!/usr/bin/python3

import tkinter as tk
from tkinter import messagebox

class Application(tk.Frame):

def __init__(self, master):
super().__init__(master)
self.master = master
self.pack()
self.createWidgets()

def createWidgets(self):
tk.messagebox.askquestion("Use An Existing File", "Do you want to load 
and use an existing file?")
tk.Entry(self.master, width = 20).pack()

if __name__ == "__main__":
root = tk.Tk()
app = Application(root)
app.mainloop()

--

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2021-01-10 Thread Roland Hieber


Change by Roland Hieber :


--
pull_requests: +23016
pull_request: https://github.com/python/cpython/pull/24189

___
Python tracker 

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



[issue42884] array.index() missing start and end

2021-01-10 Thread Zackery Spytz


Zackery Spytz  added the comment:

This seems like a duplicate of bpo-31956.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue42884] array.index() missing start and end

2021-01-10 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +rhettinger

___
Python tracker 

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



[issue42129] Support resources in namespace packages

2021-01-10 Thread Filipe Laíns

Filipe Laíns  added the comment:

Yes, I will look into it. Do we have a time schedule for when this should be 
ready, so that I can organize myself?

--

___
Python tracker 

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



[issue34804] Repetition of 'for example' in documentation

2021-01-10 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10 -Python 2.7, Python 3.4, Python 3.5, Python 3.6, 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



[issue42884] array.index() missing start and end

2021-01-10 Thread Daniel Nicorici


New submission from Daniel Nicorici :

Add support for array.index(x [,start [,end]]). Adding start and end would 
allow to loop thru the entire array (and not start all the time from 0).


Currently, is array.index(x) (and it returns the smallest i such that i is the 
index of the first occurrence of x in the array). 


For example, bytearray.index() has start and end and list.index() has also 
start and end, but for some reason start and end are missing from array.index.

--
messages: 384775
nosy: daniel.nicorici
priority: normal
severity: normal
status: open
title: array.index() missing start and end
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



[issue42874] running configure on Solaris 10 gives grep "illegal option" errors

2021-01-10 Thread Ned Deily


Change by Ned Deily :


--
components: +Build -Installation

___
Python tracker 

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



[issue42874] running configure on Solaris 10 gives grep "illegal option" errors

2021-01-10 Thread Ned Deily


Change by Ned Deily :


--
title: configure errors -> running configure on Solaris 10 gives grep "illegal 
option" errors

___
Python tracker 

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



[issue42882] Restarting the interpreter causes UB on 3.10.0a4

2021-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ned Deily


Ned Deily  added the comment:

Yes, otool should work.  Something like:

$ otool -L $(python3.9 -c 'import _ctypes;print(_ctypes.__file__)')
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_ctypes.cpython-39-darwin.so:
/usr/lib/libffi.dylib (compatibility version 1.0.0, current version 
27.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1292.0.0)

/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 
(compatibility version 150.0.0, current version 1770.106.0)

--

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ziqiao Kong


Ziqiao Kong  added the comment:

Thanks for your reply. What shall I do to confirm the version of libffi? By 
otool?


From: report=bugs.python@roundup.psfhosted.org 
 on behalf of Ned Deily 

Sent: Monday, January 11, 2021 2:17:53 AM
To: ziqiaok...@gmail.com 
Subject: [issue42880] ctypes: variadic function call still doesn't work on 
Apple Silicon

Ned Deily  added the comment:

(I also get *34* when building v3.10.0a4 from source on the M1 with 11.1 and 
Xcode 12.3.)

--

___
Python tracker 

___

--

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ned Deily


Ned Deily  added the comment:

(I also get *34* when building v3.10.0a4 from source on the M1 with 11.1 and 
Xcode 12.3.)

--

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ned Deily


Ned Deily  added the comment:

I tried your test programs on a M1 Mac running macOS 11.1 with the latest macOS 
universal2 Pythons available from python.org 
(https://www.python.org/downloads/), 3.9.1 and 3.10.0a4, and both produced the 
same (correct) result as in your 3.8 example.  Are you sure the brew Pythons 
are using the macOS 11 system libffi and not their own or older version?

--

___
Python tracker 

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



[issue42880] ctypes: variadic function call still doesn't work on Apple Silicon

2021-01-10 Thread Ned Deily


Change by Ned Deily :


--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue42129] Support resources in namespace packages

2021-01-10 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In [this 
commit](https://github.com/python/importlib_resources/commit/bd20d893f11f387d285c666bc99fd2d4a7c33ef8),
 I've reconciled and merged the changes from importlib_resources 3.2-5.0, 
mainly the namespace package support 
(https://importlib-resources.readthedocs.io/en/latest/history.html#v5-0-0).

Applying these changes to cpython and running the tests, there appear to be two 
emergent failure modes:

```
cpython master $ http --follow 
https://github.com/python/importlib_resources/archive/cpython.zip | bsdtar 
--strip-components 1 -x
$ ./python.exe Tools/scripts/run_tests.py test.test_importlib 2>&1 | gist -Pc
https://gist.github.com/dde7d5a951d92726380dced21503f843
```

In my estimation, the first two failures are due to the change in the 
abc.ResourceReader for contents to raise FileNotFoundError.

And the latter failures are seemingly due to the built-in NamespaceLoader not 
having a resource reader. I suspect the fix here is to add a 
.get_resource_reader() method to _NamespaceLoader to return a NamespaceReader. 
(hint: when updating _bootstrap_external.py, you'll need to run `make 
regen-importlib` or `make regen-all` and recompile).

Filipe, would you be interested in exploring these issues and propose some 
fixes and prepare the PR that applies the changes to CPython?

--

___
Python tracker 

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



[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

See also https://github.com/python/mypy/issues/640 "Support type(None) as a 
type", which was closed with "I don't think anyone cares". Jukka's comment was 
"Or maybe we should update PEP 484 to not suggest that type(None) is valid as a 
type, and None is the only correct spelling? There should one -- and preferably 
only one -- obvious way to do it etc."

Despite the fact that I'd also like to see only one way to do things, other 
than tests that will break when using get_type_hints instead of looking at 
annotations directly, I'm not sure it makes much difference. People already 
need to treat type(None) as equivalent to None for annotations: we're late to 
the game for making a change.

--

___
Python tracker 

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



[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

Notice that this isn't just for __init__ or return types, it happens with any 
annotations (here, with 3.8):

>>> def g(i: None): pass
...
>>> g.__annotations__
{'i': None}
>>> get_type_hints(g)
{'i': }
>>>

I just noticed that PEP 484 also says:

https://www.python.org/dev/peps/pep-0484/#using-none

"When used in a type hint, the expression None is considered equivalent to 
type(None)."

But I find it odd that get_type_hints would make this determination for you.

--

___
Python tracker 

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



[issue42883] __init__ function may incur an incorrect behavior if passing a list as a parameter and set its default value as empty

2021-01-10 Thread Haoyang


Haoyang  added the comment:

Thanks!

--

___
Python tracker 

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



[issue42883] __init__ function may incur an incorrect behavior if passing a list as a parameter and set its default value as empty

2021-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

https://docs.python.org/3/faq/programming.html#why-are-default-values-shared-between-objects

--
nosy: +serhiy.storchaka
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



[issue42883] __init__ function may incur an incorrect behavior if passing a list as a parameter and set its default value as empty

2021-01-10 Thread Haoyang


New submission from Haoyang :

Here is the bug-triggered code snippet in the file uploaded

class A:
def __init__(self, b=[]):
print('b = ', b)
self.a = b 

for i in range(3):
a = A()
a.a.append(1)

print(a.a)

It seems that when I pass a list "b" to __init__ function with default value 
empty list. Every time I create a new instance of this class and append one new 
variable to "self.a", the default value of "b" changed at the next time I 
create another instance of class A.

The outcome of this code snippet is 
a =  []
[1]
a =  [1]
[1, 1]
a =  [1, 1]
[1, 1, 1]

I am new to python. Is it a legal behavior in python? If yes, what is the 
principle beneath it? Thanks in advance!

--
files: test.py
messages: 384765
nosy: haoyang9804
priority: normal
severity: normal
status: open
title: __init__  function may incur an incorrect behavior if passing a list as 
a parameter and set its default value as empty
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file49732/test.py

___
Python tracker 

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



[issue42875] argparse incorrectly shows help string on a new line in case of long command string

2021-01-10 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



[issue42879] SystemError from class 'int'

2021-01-10 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

With debug build of Python I get a crash in other place:

$ ./python -Xdev Movement.py 
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
python: Objects/abstract.c:155: PyObject_GetItem: Assertion `(item != NULL) ^ 
(PyErr_Occurred() != NULL)' failed.
Fatal Python error: Aborted

Current thread 0x7fc3d0b6e280 (most recent call first):
  File "Movement.py", line 47 in writeGridToSurface
  File "Movement.py", line 100 in 

It is very likely a bug in Pygame. Perhaps it was always here, just Python 3.8 
is more strict to programming errors in extensions.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41748] HTMLParser: comma in attribute values with/without space

2021-01-10 Thread karl


karl  added the comment:

Status: The PR should be ready and completed
https://github.com/python/cpython/pull/24072
and eventually be merged at a point. 
Thanks to ezio.melotti for the wonderful guidance.

--

___
Python tracker 

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



[issue42879] SystemError from class 'int'

2021-01-10 Thread Jason Oliver


Jason Oliver  added the comment:

I will submit the bug report to the pygame bug tracker.

--

___
Python tracker 

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



[issue42882] Restarting the interpreter causes UB on 3.10.0a4

2021-01-10 Thread Yannick Jadoul


New submission from Yannick Jadoul :

Issue detected in the embedding tests of pybind11, running on the latest alpha 
of 3.10: https://github.com/pybind/pybind11/issues/2774

I have reduced the weird issue/crash to a minimal reproducer, which 
consistently reproduces the crash on my Linux machine:

```
#include 

int main() {
Py_InitializeEx(1);

Py_Finalize();
Py_InitializeEx(1);

PyRun_SimpleString("class Widget: pass\n"
   "class DerivedWidget(Widget):\n"
   "def __init__(self):\n"
   "super().__init__()\n");

Py_Finalize();

printf("Works\n");

return 0;
}
```

Removing the two lines in the middle that restart the interpreter makes the 
example work.

I've also bisected CPython to find the issue (3.10.0a3 is fine, 3.10.0a4 is 
not), and arrived at https://github.com/python/cpython/pull/20058 
(ba3d67c2fb04a7842741b1b6da5d67f22c579f33 being the first commit that breaks 
the example above). But I am not entirely sure where to start debugging.

The reproducing example above consistently crashes on my local machine 
(SIGABRT, exit code 134):

```
Fatal Python error: compiler_make_closure: lookup '__class__' in DerivedWidget 
5 -1
freevars of __init__: ('__class__',)

Python runtime state: initialized

Current thread 0x7f036485b680 (most recent call first):

Aborted (core dumped)
```

But note that in the pybind11 tests, the underlying issue causes a different 
error (Python throwing a weird, seemingly unrelated exception). So something 
seems to be messed up in the interpreter internals, and the above example just 
triggers it.

--
components: Interpreter Core
messages: 384761
nosy: YannickJadoul
priority: normal
severity: normal
status: open
title: Restarting the interpreter causes UB on 3.10.0a4
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



[issue42881] Should typing.get_type_hints change None annotations?

2021-01-10 Thread Larry Hastings


New submission from Larry Hastings :

PEP 484 says:

(Note that the return type of __init__ ought to be annotated
 with -> None. The reason for this is subtle. [...]

https://www.python.org/dev/peps/pep-0484/#the-meaning-of-annotations

If you follow this advice, then call typing.get_type_hints() on your __init__ 
function, you'll find it has turned "None" into "type(None)".

git blame suggests get_type_hints' behavior was in the initial checkin of 
typing.py (46dbb7d1032c19163f37785509b8f5b3004416e8).  So it's always behaved 
this way.

Is "None" still considered the correct return annotation of an __init__?  If 
so, should typing.get_type_hints() really be changing it to type(None)?

--
components: Library (Lib)
messages: 384760
nosy: eric.smith, gvanrossum, larry
priority: low
severity: normal
stage: test needed
status: open
title: Should typing.get_type_hints change None annotations?
type: behavior
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



[issue42879] SystemError from class 'int'

2021-01-10 Thread Mark Dickinson


Mark Dickinson  added the comment:

This is more likely to be a bug in Pygame than in Python itself. What's likely 
happening here is that some part of the Pygame machinery is setting an 
exception state but then returning a value as normal. (Generally, if some 
function in a C extension sets an exception, that function should return NULL 
or -1.) That then leaves things in an inconsistent state, and Python doesn't 
notice that inconsistent state until the "int" call happens.

Please could you report to the Pygame folks, if you haven't done so already? It 
certainly is *possible* that it's actually a core Python bug, but even then the 
first step would be to eliminate the Pygame component from the 
code-to-reproduce.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue42619] python 3.9.1 failed to create .so files as universal2 (arm64, x86_64) on Mac

2021-01-10 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

> Another change that might be needed: ensure that sysconfig.get_platform() 
> does not return "universal2" as the binary architecture when the compiler 
> does not support arm64.

Hmmm... _osx_support.get_platform_osx() contains the following comment:

# Use the original CFLAGS value, if available, so that we
# return the same machine type for the platform string.
# Otherwise, distutils may consider this a cross-compiling
# case and disallow installs.

That indicates that fixing the value of sysconfig.get_platform() when using a 
"universal2" python on a system that doesn't support arm64 might break distils. 

I haven't done further research on this. In general I'd prefer to create the 
correct platform tag, but not if that results in not being able to install 
extensions.

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



[issue42619] python 3.9.1 failed to create .so files as universal2 (arm64, x86_64) on Mac

2021-01-10 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've added a (draft) PR for this. The PR is a this time not tested on a 10.15 
system.

Another change that might be needed: ensure that sysconfig.get_platform() does 
not return "universal2" as the binary architecture when the compiler does not 
support arm64.

--

___
Python tracker 

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



[issue42619] python 3.9.1 failed to create .so files as universal2 (arm64, x86_64) on Mac

2021-01-10 Thread Ronald Oussoren


Change by Ronald Oussoren :


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

___
Python tracker 

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



[issue41798] [C API] Revisit usage of the PyCapsule C API with multi-phase initialization API

2021-01-10 Thread hai shi


Change by hai shi :


--
pull_requests: +23014
pull_request: https://github.com/python/cpython/pull/24186

___
Python tracker 

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