[issue43345] Add __required_keys__ and __optional_keys__ to TypedDict documentation

2021-02-27 Thread Paul Bryan


Change by Paul Bryan :


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



[issue43345] Add __required_keys__ and __optional_keys__ to TypedDict documentation

2021-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 1e3c68246ee738b5ec5450b1eb39af2fca300cb9 by Paul Bryan in branch 
'master':
bpo-43345: Enhance TypedDict documentation. (#24668)
https://github.com/python/cpython/commit/1e3c68246ee738b5ec5450b1eb39af2fca300cb9


--

___
Python tracker 

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



[issue43345] Add __required_keys__ and __optional_keys__ to TypedDict documentation

2021-02-27 Thread Paul Bryan


Change by Paul Bryan :


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

___
Python tracker 

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



[issue43345] Add __required_keys__ and __optional_keys__ to TypedDict documentation

2021-02-27 Thread Paul Bryan


Change by Paul Bryan :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue43345] Add __required_keys__ and __optional_keys__ to TypedDict documentation

2021-02-27 Thread Paul Bryan


New submission from Paul Bryan :

>From Typing-sig list:

On Thu, Feb 11, 2021 at 10:54 PM Paul Bryan  wrote:
> I don't think __required_keys__ or __optional_keys__ are documented, at least 
> not in https://docs.python.org/3.10/library/typing.html. Is there any reason 
> we can't codify them in 3.10 docs?

On Fri, 2021-02-12 at 14:23 -0800, Guido van Rossum wrote:
> Nobody got to it yet? Maybe you'd be willing to submit a small PR for this?

--
assignee: docs@python
components: Documentation
messages: 387802
nosy: docs@python, pbryan
priority: normal
severity: normal
status: open
title: Add __required_keys__ and __optional_keys__ to TypedDict documentation
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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-27 Thread Carol Willing


Carol Willing  added the comment:

Folks, The What's New PR is open now. I've tried to focus more on the data 
type/shape examples over literal example.

--

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-27 Thread Carol Willing


Change by Carol Willing :


--
pull_requests: +23452
pull_request: https://github.com/python/cpython/pull/24667

___
Python tracker 

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



[issue43335] _ctypes/callbacks.c cannot be compiled by gcc 4.4.7 (RHEL6)

2021-02-27 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you Daniel for reporting and suggestion!

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



[issue43335] _ctypes/callbacks.c cannot be compiled by gcc 4.4.7 (RHEL6)

2021-02-27 Thread miss-islington


miss-islington  added the comment:


New changeset 132e31f4bf20818a469cbcdba75068f26cb19a65 by Miss Islington (bot) 
in branch '3.9':
bpo-43335: Update macro to check gcc version (GH-24662)
https://github.com/python/cpython/commit/132e31f4bf20818a469cbcdba75068f26cb19a65


--

___
Python tracker 

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



[issue43335] _ctypes/callbacks.c cannot be compiled by gcc 4.4.7 (RHEL6)

2021-02-27 Thread Dong-hee Na


Change by Dong-hee Na :


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



weirdness with list()

2021-02-27 Thread Cameron Simpson
I just ran into a surprising (to me) issue with list() on an iterable 
object.

My object represents an MDAT box in an MP4 file: it is the ludicrously 
large data box containing the raw audiovideo data; for a TV episode it 
is often about 2GB and a movie is often 4GB to 6GB. For obvious reasons, 
I do not always want to load that into memory, or even read the data 
part at all when scanning an MP4 file, for example to recite its 
metadata.

So my parser has a "skip" mode where it seeks straight past the data, 
but makes a note of its length in bytes. All good.

That length is presented via the object's __len__ method, because I want 
to know that length later and this is a subclass of a suite of things 
which return their length in bytes this way.

So, to my problem:

I've got a walk method which traverses the hierarchy of boxes in the MP4 
file. Until some minutes ago, it looked like this:

  def walk(self):
subboxes = list(self)
yield self, subboxes
for subbox in subboxes:
  if isinstance(subbox, Box):
yield from subbox.walk()

somewhat like os.walk does for a file tree.

I noticed that it was stalling, and investigation revealed it was 
stalling at this line:

subboxes = list(self)

when doing the MDAT box. That box (a) has no subboxes at all and (b) has 
a very large __len__ value.

BUT... It also has a __iter__ value, which like any Box iterates over 
the subboxes. For MDAT that is implemented like this:

def __iter__(self):
yield from ()

What I was expecting was pretty much instant construction of an empty 
list. What I was getting was a very time consuming (10 seconds or more) 
construction of an empty list.

I believe that this is because list() tries to preallocate storage. I 
_infer_ from the docs that this is done maybe using 
operator.length_hint, which in turn consults "the actual length of the 
object" (meaning __len__ for me?), then __length_hint__, then defaults 
to 0.

I've changed my walk function like so:

  def walk(self):
subboxes = []
for subbox in self:
  subboxes.append(subbox)
##subboxes = list(self)

and commented out the former list(self) incantation. This is very fast, 
because it makes an empty list and then appends nothing to it. And for 
your typical movie file this is fine, because there are never _very_ 
many immediate subboxes anyway.

But is there a cleaner way to do this?

I'd like to go back to my former list(self) incantation, and modify the 
MDAT box class to arrange something efficient. Setting __length_hint__ 
didn't help: returning NotImplemeneted or 0 had no effect, because 
presumably __len__ was consulted first.

Any suggestions? My current approach feels rather hacky.

I'm already leaning towards making __len__ return the number of subboxes 
to match the iterator, especially as on reflection not all my subclasses 
are consistent about __len__ meaning the length of their binary form; 
I'm probably going to have to fix that - some subclasses are actually 
namedtuples where __len__ would be the field count. Ugh.

Still, thoughts? I'm interested in any approaches that would have let me 
make list() fast while keeping __len__==binary_length.

I'm accepting that __len__ != len(__iter__) is a bad idea now, though.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43335] _ctypes/callbacks.c cannot be compiled by gcc 4.4.7 (RHEL6)

2021-02-27 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +23451
pull_request: https://github.com/python/cpython/pull/24665

___
Python tracker 

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



[issue43335] _ctypes/callbacks.c cannot be compiled by gcc 4.4.7 (RHEL6)

2021-02-27 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset bf9de7ab24d9d7068645b202bc47146b9a4f2726 by Dong-hee Na in branch 
'master':
bpo-43335: Update macro to check gcc version (GH-24662)
https://github.com/python/cpython/commit/bf9de7ab24d9d7068645b202bc47146b9a4f2726


--

___
Python tracker 

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



[issue20503] super behaviour and abstract base classes (either implementation or documentation/error message is wrong)

2021-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This is a bit out of date.  The isinstance() docs now specify that the 
predicate tests for direct, indirect, and virtual inheritance. Likewise, the 
super() docs already specify that only the __mro__ is searched.  So those docs 
are already precise.

Am thinking of adding a FAQ entry about when direct inheritance is required and 
include the OP's example.  FWIW, this isn't really about super().  It affects 
any attribute lookup or any other property of inheritance.  A true result from 
instance() doesn't imply that actual inheritance has occurred.

--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-27 Thread Daniel Moisset


Change by Daniel Moisset :


--
pull_requests: +23450
pull_request: https://github.com/python/cpython/pull/24664

___
Python tracker 

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



[issue43325] Documentation should warn that 'is' is not a safe comparison operator for most values.

2021-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'll add a note to this effect in the tutorial.

Also, in the FAQ, we could have an entry about the three circumstances when 
"is" can relied upon:  1) variable assignment doesn't change identity, 2) 
containers that use references don't change identity, and 3) singletons don't 
change identity.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue43340] json.load() can raise UnicodeDecodeError, but this is not documented

2021-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Normally, we don't (or can't) enumerate all possible exceptions.  But
in this case, it is worth expanding the documentation so that person can know 
which of two common input errors they need to catch:

"If the data being deserialized is not valid UTF-8 a UnicodeDecodeError will be 
raised, and if the decoded file is not 
a valid JSON document, a JSONDecodeError will be raised".

--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue43340] json.load() can raise UnicodeDecodeError, but this is not documented

2021-02-27 Thread Eric V. Smith


Eric V. Smith  added the comment:

As a rule we don't try and document every exception that can be raised. I could 
go either way on documenting encoding errors with the json module, although it 
seems pretty clear that an encoding error would be possible in this case.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, eric.smith
versions:  -Python 3.6, Python 3.7

___
Python tracker 

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



[issue43344] RotatingFileHandler breaks file type associations

2021-02-27 Thread Kevin Hollingshead


New submission from Kevin Hollingshead :

The filenames generated by logging.RotatingFileHandler breaks the ability to 
associate a program (e.g. notepad++, sublime text, etc.) with the log files 
using Windows or OSX file associations because the extension is overridden by 
the added suffix. For example, if I specify the filename as "test.log" for a 
TimeBasedRotatingFileHandler with a suffix of "%Y%m%d", rolled over files are 
named test.log.MMDD. There is no way to associate a program with this type 
of file extension. A good non-breaking fix would be to add a parameter 
"extension" to RotatingFileHandler, and if specified would be applied to all 
filenames. Thus if I specify filename="test" and "extension="log" for my 
handler it would give "test.log" for the initial file and "test.MMDD.log" 
for rollover files.

--
components: Extension Modules
files: logger_bug.py
messages: 387793
nosy: kh14821
priority: normal
severity: normal
status: open
title: RotatingFileHandler breaks file type associations
type: behavior
Added file: https://bugs.python.org/file49840/logger_bug.py

___
Python tracker 

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



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

2021-02-27 Thread Tim Peters


Tim Peters  added the comment:

I'm very sorry for not keeping up with this - my health has been poor, and I 
just haven't been able to make enough time.

Last time I looked to a non-trivial depth, I was quite happy, and just 
quibbling about possible tradeoffs.

I can't honestly commit to doing better in the near future, so where does that 
leave us? I'd personally "risk it".

I just added Raymond to the nosy list, on the off chance he can make some 
"emergency time" to give a more informed yes/no. He's routinely sucked up weeks 
of my life with random review requests, so I figure turnabout is fair play ;-)

--
nosy: +rhettinger

___
Python tracker 

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



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

2021-02-27 Thread Guido van Rossum


Guido van Rossum  added the comment:

If Tim approves we might get it into alpha 6 which goes out Monday.

--

___
Python tracker 

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



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

2021-02-27 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Any chance PR 22904 can make it into 3.10 before the May 03 feature freeze? The 
text document in that PR has some notes on how the algorithm works, so that may 
be a good place to start reviewing if anyone is interested.

--

___
Python tracker 

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



[issue43342] Error while using Python C API

2021-02-27 Thread Piyush Patel


Piyush Patel  added the comment:

So upon further investigation, it seems all the built-in functions are not 
working. 

def func():
max(10,20)

this code errors out saying "name 'max' is not defined"

so when python installation is in custom location or parent folder name is 
"python", the embedded python in C++ application behavior is bad and 
inconsistent.

--

___
Python tracker 

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



[issue43060] Convert _decimal C API from pointer array to struct

2021-02-27 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> In my opinion, an array of pointers is a bad API;

The existing code is how types were made for most of Python's history.  It is 
not "bad"; it is just more wordy.  Given that the current code is correct, I 
don't see any strong reason to churn the code.

--
nosy: +rhettinger

___
Python tracker 

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



[issue43341] functools.partial missing __weakref__ descriptor?

2021-02-27 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



Re: Where is the problem?

2021-02-27 Thread Cousin Stanley
RD wrote:

> In article , cousinstan...@gmail.com says...
>  
> [snip]
> 
>>   I have a couple of postscript saving examples
>>   that include the following geometry parameters
>>   which produce  .ps  files that render the same
>>   as the canvas drawings when viewed in ghostsript.
> 
>> retval = canvas.postscript(
>>file   = "image/ps/xyzzy.ps ,
>>height = 400 ,
>>width  = 400 ,
>>pagewidth  = 400 ,
>>pageheight = 400 ,
>>colormode = "color" )
>  
> [snip]
> 
> Wow! It worked! Thankyouthankyouthankyou.
> 
> RD

  You're welcome  
  You're Welcome  
  You're Welcome 
  

-- 
Stanley C. Kitching
Human Being
Phoenix, Arizona

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


Fwd: How to cycle through servers on Connection Fail in an IRC client?

2021-02-27 Thread inhahe
I'm not sure if it's okay to ask about Twisted in this mailing list, but
Twisted's mailing list seems to have ignored my submission for some reason.
And their mailing list seems mostly dead anyway. So here goes:

I'm making an IRC client  using Twisted, and I want to connect to a
different server when connection fails, but I haven't been able to figure
out how to do that..

Here's a more or less minimal code sample reflecting what I have now:



from twisted.words.protocols import irc
from twisted.internet import protocol
from twisted.internet import reactor

class ServerConnection(irc.IRCClient):

  def __init__(self):
self.signedon = False
self.nickindex = 0

  def signedOn(self):
print("signed on")

  def nickChanged(self, newnick):
self.nickname = newnick

class Network(object):
  def __init__(self, servers, mynick=None):
self.servers = servers
self.mynick = mynick
self.serverindex = 0

class ServerFactory(protocol.ReconnectingClientFactory):
  def __init__(self, nickname="qttwirc", password=None, username="qttwirc",
realname=None, network=None):
self.network = network
self.network.mynick = nickname
self.nickname = nickname
self.username = username
self.password = password
self.realname = realname
protocol.ReconnectingClientFactory.initialDelay = 10 #should i leave
this at 1?
protocol.ReconnectingClientFactory.maxDelay = 10 #no idea what value
this should be. 3.5 wasn't slow enough, i was being throttled.

  def buildProtocol(self, addr):
p = ServerConnection()
self.serverconnection = p
p.server = self
p.nickname = self.nickname
p.username = self.username
self.resetDelay()
return p

  def clientConnectionLost(self, connector, reason):
self.serverconnection = None
protocol.ReconnectingClientFactory.clientConnectionLost(self,
connector, reason)

  def clientConnectionFailed(self, connector, reason):
self.serverconnection = None
addr, port = self.network.servers[self.network.serverindex]
self.network.serverindex = (self.network.serverindex+1) %
len(self.network.servers) #todo: make it actually use these values

#reactor.callLater(config.reconnectdelay, reactor.connectTCP,
addr.encode("ascii"), port, self)
#reactor.connectTCP(addr, port, self) #is this feasible? i don't know a
better way to do this. connector.connect() apparently doesn't take
server/port as arguments.

protocol.ReconnectingClientFactory.clientConnectionFailed(self,
connector, reason)

network = Network([("hitchcock.freenode.net", 6667), ("verne.freenode.net",
6667)])
server = ServerFactory(nickname="test123", username="test123",
network=network)
reactor.connectTCP(*network.servers[network.serverindex], server)
reactor.run()



If I have to completely change the structure of how I connect, that's
fine.. I don't understand Twisted very well, so I'm not aware of what some
other options are for how to make an IRC client.

(It probably doesn't matter, but in my actual program I'm using both
Twisted and PyQt5 in the same run loop using qt5reactor..)

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


[issue31030] sys.executable can be not normalized

2021-02-27 Thread Eryk Sun


Eryk Sun  added the comment:

> If it was the tests, they seem to have been fixed elsewhere.

The cited tests haven't been changed to work with non-normalized 
sys.executable, sys.prefix, etc. But it's not common to run the test suite with 
a non-normalized path such as "Lib/../build/python".

> you stated above that on Windows a \\?\ path is possible but 
> will not work for startup, and that you would open an issue 

Sorry, I don't remember the details of the bug that I mentioned. But it became 
a non-issue in 3.6+, which canonicalizes the executable path. For example:

>>> exe = r'\\?\C:\Program Files\Python36\python.exe'
>>> cmd = 'python -c "import sys; print(sys.executable)"'
>>> subprocess.call(cmd, executable=exe)
C:\Program Files\Python36\python.exe
0

Compare the latter to the output of GetModuleFileNameW(NULL, ...) in this case, 
which returns a \\?\ extended (verbatim) path:

>>> exe = r'\\?\C:\Program Files\Python36\python.exe'
>>> cmd = 'python -c "import _winapi; print(_winapi.GetModuleFileName(0))"'
>>> subprocess.call(cmd, executable=exe)
\\?\C:\Program Files\Python36\python.exe
0

> Do any of the non-normalized Linux (or *nix) executable paths fail for 
> startup?

Not that I'm aware of. AFAIK, it's just about the particular tests failing in 
this case.

--

___
Python tracker 

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



[issue43343] argparse.REMAINDER missing in online documentation for 3.9.x

2021-02-27 Thread Chigozirim Chukwu


New submission from Chigozirim Chukwu :

Since 3.9.0, the online documentation for the argparse module is missing 
reference for argparse.REMAINDER.

If the feature has been deprecated, can we get atleast a mention in the 
deprecation notes as to what one should now prefer.

If it was just a mistake, then I guess I'm just here to bring some attention to 
it.

Thanks

--
components: Library (Lib)
messages: 387786
nosy: smac89
priority: normal
severity: normal
status: open
title: argparse.REMAINDER missing in online documentation for 3.9.x
type: enhancement
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



[issue25024] Allow passing "delete=False" to TemporaryDirectory

2021-02-27 Thread Ashwin Ramaswami


Ashwin Ramaswami  added the comment:

I agree -- as a user, it wasn't clear to me from looking at the documentation 
that mkdtemp was the right way to go to not delete directories. I had expected 
that NamedTemporaryDirectory would also support delete=False, just like 
NamedTemporaryFile.


Given that we say in the documentation that "mkstemp() and mkdtemp() are 
lower-level functions which require manual cleanup", it seems to make sense to 
allow Python users who don't care / know about mkstemp / mkdtemp to just use 
the more user-friendly NamedTemporaryDirectory / NamedTemporaryFile classes. 
This would make the language more accessible.

Would we be fine with reopening this issue so someone can contribute a patch?

--
nosy: +epicfaace

___
Python tracker 

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



Re: Where is the problem?

2021-02-27 Thread RD
In article , cousinstan...@gmail.com says...
 
[snip]

>   I have a couple of postscript saving examples
>   that include the following geometry parameters
>   which produce  .ps  files that render the same
>   as the canvas drawings when viewed in ghostsript.

> retval = canvas.postscript( 
>file   = "image/ps/xyzzy.ps , 
>height = 400 , 
>width  = 400 ,
>pagewidth  = 400 , 
>pageheight = 400 ,  
>colormode = "color" )
 
[snip]

Wow! It worked! Thankyouthankyouthankyou.

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


[issue31447] proc communicate not exiting on python subprocess timeout using PIPES

2021-02-27 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Library (Lib), Windows -Interpreter Core
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6, Python 3.7

___
Python tracker 

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



[issue32795] subprocess.check_output() with timeout does not exit if child process does not generate output after timeout

2021-02-27 Thread Eryk Sun


Eryk Sun  added the comment:

Issue 37424 fixed this for Python 3.7+ in POSIX. It's still broken in Windows, 
for which I'm leaving issue 31447 open.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
superseder:  -> subprocess.run timeout does not function if shell=True and 
capture_output=True

___
Python tracker 

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



[issue43342] Error while using Python C API

2021-02-27 Thread Piyush Patel


New submission from Piyush Patel :

Hi,
I am facing a very strange issue.
I am working on a C++ application which embeds a python.
As per documentation i have the dependencies added from python (/libs and 
/include directories) to C++ application.
I am using Py_RunString() to run simple python code.

Python code is simple:

import os
def Func():
return 10.0

The application run smoothly when i have python installation in directory like 
"C:\PythonXY\"

but if python installation is in directory like "C:\MyPython\" or default 
installation path AppData\local\program\python\pythonxy\ , python code errors 
out.

the error i am getting is "__import__ not found".

I have used PyErr_Fetch to retrieve error.

It's really strange that the python installation directory affects how Python  
code is run.

It seems it have a problem running "import os" statement or any "import" 
statement.


Could you help me how i can resolve this issue? 

Thanks,
Piyush

--
components: C API
messages: 387783
nosy: piyush115
priority: normal
severity: normal
status: open
title: Error while using Python C API
type: compile error
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



[issue31030] sys.executable can be not normalized

2021-02-27 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This issue was opened with 2 related facts of 2017:
a) sys.executable is not normalized
b) as a result, two tests failed
Serhiy then said "I don't know what is wrong: the value of sys.executable or 
the test."  If it was the tests, they seem to have been fixed elsewhere.

If it is the non-normalization of sys.executable, my concern for IDLE is that 
it starts the execution subprocess with subprocess.Popen([sys.executable, 
...]).  Could this be a reason for mysterious IDLE failures?

Eryk, you stated above that on Windows a \\?\ path is possible but will not 
work for startup, and that you would open an issue for this.  Have you?

Do any of the non-normalized Linux (or *nix) executable paths fail for startup?

--

___
Python tracker 

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



[issue43341] functools.partial missing __weakref__ descriptor?

2021-02-27 Thread Dan Snider


New submission from Dan Snider :

The only way to lookup weak references to functools.partial objects is with 
weakref.getweakrefs. I don't know if it's normal for extension types that 
define tp_weaklistoffset to not add a __weakref__ descriptor, but I figured at 
the very least a subtype specifying "__weakref__" in its __slots__ could get 
one. Instead, it fails with the partially true TypeError: __weakref__ slot 
disallowed: either we already got one, or __itemsize__ != 0.

--
messages: 387781
nosy: bup
priority: normal
severity: normal
status: open
title: functools.partial missing __weakref__ descriptor?
type: behavior
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



[issue43340] json.load() can raise UnicodeDecodeError, but this is not documented

2021-02-27 Thread Matthew Woodcraft

New submission from Matthew Woodcraft :

The documentation for json.load() and json.loads() says:

« If the data being deserialized is not a valid JSON document, a 
JSONDecodeError will be raised. »

But this is not currently entirely true: if the data is provided in bytes form 
and is not properly encoded in one of the three accepted encodings, 
UnicodeDecodeError is raised instead.

(I have no opinion on whether the documentation or the behaviour should be 
changed.)

--
components: Library (Lib)
messages: 387780
nosy: mattheww
priority: normal
severity: normal
status: open
title: json.load() can raise UnicodeDecodeError, but this is not documented
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



[issue43335] _ctypes/callbacks.c cannot be compiled by gcc 4.4.7 (RHEL6)

2021-02-27 Thread DANIEL VILLENEUVE


DANIEL VILLENEUVE  added the comment:

I'll let you do so if it's ok for you, since I'm not equipped with Python dev 
tools.

Regards

--

___
Python tracker 

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



Re: Not able to use python properly

2021-02-27 Thread Mats Wichmann

On 2/27/21 3:45 PM, Sahaj Verma wrote:
 


I am not able to install and use pip .

I have installed python 3.9.2 version on my laptop but I am unable to use
pip function.

Kindly look into this matter as soon as possible.

Thanking You.

Sahaj Verma

 


Sent from [1]Mail for Windows 10



You're on windows. pip isn't in your path - it's in the Scripts 
subdirectory of the main python installation location.


You can add this to the path, but it's probably more reliable to use it 
as a module instead.  If you have the Python Launcher installed (that's 
recommended for the python.org installation):


py -m pip list

(for example - to show already-installed packages).


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


[issue24650] Error in yield expression documentation

2021-02-27 Thread Jacob Walls


Change by Jacob Walls :


--
keywords: +patch
nosy: +jacobtylerwalls
nosy_count: 4.0 -> 5.0
pull_requests: +23449
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/24663

___
Python tracker 

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



Re: Not able to use python properly

2021-02-27 Thread Peter Pearson
On Sat, 27 Feb 2021 17:45:42 -0500, Sahaj Verma  wrote:
> 
>
>I am not able to install and use pip .
>
>I have installed python 3.9.2 version on my laptop but I am unable to use
>pip function.
>
>Kindly look into this matter as soon as possible.
>
>Thanking You.
>
>Sahaj Verma
>
> 
>
>Sent from [1]Mail for Windows 10
>
> 
>
> References
>
>Visible links
>1. https://go.microsoft.com/fwlink/?LinkId=550986

Your chances of getting useful help will be much improved
if you provide more information.  "I am unable to use
pip function" could result from many varied causes.  Is
your screen completely black?


-- 
To email me, substitute nowhere->runbox, invalid->com.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter needed as a legacy version 2.7 imports the module...

2021-02-27 Thread Grant Edwards
On 2021-02-26, MRAB  wrote:
> On 2021-02-26 22:23, Kevin M. Wilson via Python-list wrote:
>
>> Is there a site where I might/can download a version of Tkinter for Python 
>> 2.7?
>
> Tkinter as already included in Python 2.7.

Not always, it depends on how he installed Python 2.7.  That said,
MRAB is right that you don't install Tkinter seperately. You

 1. Include it when you configure and build python

 2. Install a binary Python distribution that aleady includes it.

--
Grant




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


Not able to use python properly

2021-02-27 Thread Sahaj Verma
    

   I am not able to install and use pip .

   I have installed python 3.9.2 version on my laptop but I am unable to use
   pip function.

   Kindly look into this matter as soon as possible.

   Thanking You.

   Sahaj Verma

    

   Sent from [1]Mail for Windows 10

    

References

   Visible links
   1. https://go.microsoft.com/fwlink/?LinkId=550986
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Tkinter needed as a legacy version 2.7 imports the module...

2021-02-27 Thread Alan Gauld via Python-list
On 26/02/2021 22:23, Kevin M. Wilson via Python-list wrote:
> Hey Community,    Is there a site where I might/can download a version of 
> Tkinter for Python 2.7?

Which OS?

If it's Linux you may need to fetch the tkinter
package for your distro.

In Windoze it should come as standard

In MacOS (or any other OS) ... Ask someone who knows...


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


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


SQLObject 3.9.1

2021-02-27 Thread Oleg Broytman via Python-announce-list
Hello!

I'm pleased to announce version 3.9.1, the first minor feature release
of branch 3.9 of SQLObject.


What's new in SQLObject
===

Drivers
---

* Adapt to the latest ``pg8000``.

* Protect ``getuser()`` - it can raise ``ImportError`` on w32
  due to absent of ``pwd`` module.

Build
-

* Change URLs for ``oursql`` in ``extras_require`` in ``setup.py``.
  Provide separate URLs for Python 2.7 and 3.4+.

* Add ``mariadb`` in ``extras_require`` in ``setup.py``.

CI
--

* For tests with Python 3.4 run ``tox`` under Python 3.5.

Tests
-

* Refactor ``tox.ini``.

For a more complete list, please see the news:
http://sqlobject.org/News.html


What is SQLObject
=

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite;
connections to other backends - Firebird, Sybase, MSSQL
and MaxDB (also known as SAPDB) - are lesser debugged).

Python 2.7 or 3.4+ is required.


Where is SQLObject
==

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Download:
https://pypi.org/project/SQLObject/3.9.1

News and changes:
http://sqlobject.org/News.html

StackOverflow:
https://stackoverflow.com/questions/tagged/sqlobject


Example
===

Create a simple class that wraps a table::

  >>> from sqlobject import *
  >>>
  >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
  >>>
  >>> class Person(SQLObject):
  ... fname = StringCol()
  ... mi = StringCol(length=1, default=None)
  ... lname = StringCol()
  ...
  >>> Person.createTable()

Use the object::

  >>> p = Person(fname="John", lname="Doe")
  >>> p
  
  >>> p.fname
  'John'
  >>> p.mi = 'Q'
  >>> p2 = Person.get(1)
  >>> p2
  
  >>> p is p2
  True

Queries::

  >>> p3 = Person.selectBy(lname="Doe")[0]
  >>> p3
  
  >>> pc = Person.select(Person.q.lname=="Doe").count()
  >>> pc
  1

Oleg.
-- 
Oleg Broytmanhttps://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com


SQLObject 3.9.1

2021-02-27 Thread Oleg Broytman
Hello!

I'm pleased to announce version 3.9.1, the first minor feature release
of branch 3.9 of SQLObject.


What's new in SQLObject
===

Drivers
---

* Adapt to the latest ``pg8000``.

* Protect ``getuser()`` - it can raise ``ImportError`` on w32
  due to absent of ``pwd`` module.

Build
-

* Change URLs for ``oursql`` in ``extras_require`` in ``setup.py``.
  Provide separate URLs for Python 2.7 and 3.4+.

* Add ``mariadb`` in ``extras_require`` in ``setup.py``.

CI
--

* For tests with Python 3.4 run ``tox`` under Python 3.5.

Tests
-

* Refactor ``tox.ini``.

For a more complete list, please see the news:
http://sqlobject.org/News.html


What is SQLObject
=

SQLObject is an object-relational mapper.  Your database tables are described
as classes, and rows are instances of those classes.  SQLObject is meant to be
easy to use and quick to get started with.

SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite;
connections to other backends - Firebird, Sybase, MSSQL
and MaxDB (also known as SAPDB) - are lesser debugged).

Python 2.7 or 3.4+ is required.


Where is SQLObject
==

Site:
http://sqlobject.org

Development:
http://sqlobject.org/devel/

Mailing list:
https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss

Download:
https://pypi.org/project/SQLObject/3.9.1

News and changes:
http://sqlobject.org/News.html

StackOverflow:
https://stackoverflow.com/questions/tagged/sqlobject


Example
===

Create a simple class that wraps a table::

  >>> from sqlobject import *
  >>>
  >>> sqlhub.processConnection = connectionForURI('sqlite:/:memory:')
  >>>
  >>> class Person(SQLObject):
  ... fname = StringCol()
  ... mi = StringCol(length=1, default=None)
  ... lname = StringCol()
  ...
  >>> Person.createTable()

Use the object::

  >>> p = Person(fname="John", lname="Doe")
  >>> p
  
  >>> p.fname
  'John'
  >>> p.mi = 'Q'
  >>> p2 = Person.get(1)
  >>> p2
  
  >>> p is p2
  True

Queries::

  >>> p3 = Person.selectBy(lname="Doe")[0]
  >>> p3
  
  >>> pc = Person.select(Person.q.lname=="Doe").count()
  >>> pc
  1

Oleg.
-- 
Oleg Broytmanhttps://phdru.name/p...@phdru.name
   Programmers don't die, they just GOSUB without RETURN.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue43339] Could not build the ssl module! | macOS with `CPPFLAGS` and `LDFLAGS` set

2021-02-27 Thread Samuel Marks

Samuel Marks  added the comment:

Nevermind it actually was that missing `PKG_CONFIG_PATH` line…

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



[issue43339] Could not build the ssl module! | macOS with `CPPFLAGS` and `LDFLAGS` set

2021-02-27 Thread Samuel Marks


New submission from Samuel Marks :

I was on 3.10a4 on macOS 11.1 for ages, finally decided to upgrade to a5, 
building from source. With latest `brew install openssl zlib`.
```
$ export LDFLAGS='-L/usr/local/opt/openssl@1.1/lib -L/usr/local/opt/zlib/lib'
$ export CPPFLAGS='-I/usr/local/opt/openssl@1.1/include 
-I/usr/local/opt/zlib/include'
$ ./configure --enable-optimizations --prefix /opt/python3.10
```

I suppose I could set this which I forgot, but I doubt it's the problem, unless 
pkg_config is how the CPython build system find OpenSSL?
```
export PKG_CONFIG_PATH='/usr/local/opt/openssl@1.1/lib/pkgconfig'
```

Error:
```
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_hashlib  _ssl  ossaudiodev
spwd   
To find the necessary bits, look in setup.py in detect_modules() for the 
module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc  pwd   time   


Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with 
X509_VERIFY_PARAM_set1_host().
LibreSSL 2.6.4 and earlier do not provide the necessary APIs, 
https://github.com/libressl-portable/portable/issues/381
```

Happy to test alternative configurations

--
components: Build
messages: 38
nosy: samuelmarks
priority: normal
severity: normal
status: open
title: Could not build the ssl module! | macOS with `CPPFLAGS` and `LDFLAGS` set
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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-27 Thread Inada Naoki


Change by Inada Naoki :


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



[issue43321] PyArg_ParseTuple() false-returns SUCCESS though SystemError and missing data (when PY_SSIZE_T_CLEAN not #define'd)

2021-02-27 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset c71d24f55828e7f0f2c8750d2e1b04d04539beff by Inada Naoki in branch 
'master':
bpo-43321: Fix SystemError in getargs.c (GH-24656)
https://github.com/python/cpython/commit/c71d24f55828e7f0f2c8750d2e1b04d04539beff


--

___
Python tracker 

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



[issue31030] sys.executable can be not normalized

2021-02-27 Thread Eryk Sun


Eryk Sun  added the comment:

In Python 3.10 in POSIX, it's still the case that executable, prefix, 
exec_prefix, base_prefix, and base_exec_prefix in the sys module do not get 
normalized. For example, in Linux:

$ .local/bin/../bin/python3.10 -c "import sys; print(sys.executable)"
/home/someone/.local/bin/../bin/python3.10

In test/test_sys.py, assertEqual(os.path.abspath(sys.executable), 
sys.executable) fails. In test/test_venv.py, assertIn('home = %s' % path, data) 
and assertEqual(out.strip(), expected.encode()) both fail, respectively in 
test_defaults and test_prefixes.

In Windows, prior to Python 3.6, this can be a problem if Python is run via 
CreateProcessW using a non-normalized path in lpApplicationName (rare, but 
possible) instead of letting the system search for the executable in 
lpCommandLine. For example:

>>> cmd = 'python -c "import sys; print(sys.executable)"'
>>> exe = r'C:\Program Files\Python35\..\Python35\python.exe'
>>> subprocess.call(cmd, executable=exe)
C:\Program Files\Python35\..\Python35\python.exe
0

It's no longer an issue in Windows with Python 3.6 and above. When getting the 
program path while initializing, the GetModuleFileNameW(NULL, ..) result gets 
canonicalized (e.g. via PathCchCanonicalizeEx). For example:

>>> exe = r'C:\Program Files\Python36\..\Python36\python.exe'
>>> subprocess.call(cmd, executable=exe)
C:\Program Files\Python36\python.exe
0

--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue43338] [feature request] Please provide offical installers for security releases

2021-02-27 Thread Zhang Boyang


New submission from Zhang Boyang :

Hello,

Thanks for developing Python! I noticed there is no offical installers for 
security releases of old python version. This looks a little strange to me. As 
a python user & developer, it's often to stay with some old version of python, 
because some package's version constraints, or we need to support old platforms.

The offical installer is the most trusted installaion source, but it's not 
provided with security releases. Lacking of installers makes installaion 
extreme difficult (impossible for end users), and there's no (free) way for a 
individual to create a code signed copy of python. Non-code-signed binarys will 
lead a lot of problem on recent operating systems.

The choice of providing no offical installer leads a lot of user stay with 
lastest bug-fix release and not upgrading to latest security releases. 
Individuals who want to stay with a old version must either use lastest bug-fix 
release or risk running a non-code-signed python binary. The former lacks 
recent python security fix, and the latter is vulnerable to binary 
modifications such as virus infection.

To sum up, if offical installer is provided, it will make life a lot easier for 
users who want to stay with old python version. It would be appreciated if you 
could accept my feature request.

Thank you!

--
components: Installation
messages: 387774
nosy: zby1234
priority: normal
severity: normal
status: open
title: [feature request] Please provide offical installers for security releases
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



[issue42128] Structural Pattern Matching (PEP 634)

2021-02-27 Thread Daniel Moisset


Daniel Moisset  added the comment:

Thanks @xtreak, I'll make some changes in these sections too. 

The docs are coming along well, there's still some refinement to do in the 
compound statements section (it's there, but looks to big), I'll submit a draft 
PR during the weekend so interested people can review

--

___
Python tracker 

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



[issue43326] About Zipfile

2021-02-27 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> not a bug

___
Python tracker 

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



[issue21109] tarfile: Traversal attack vulnerability

2021-02-27 Thread STINNER Victor


STINNER Victor  added the comment:

What is the status of this issue?

--
nosy: +vstinner

___
Python tracker 

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