New submission from Pierre Ossman :
There is a big gotcha in Python that is easily overlooked and should at the
very least be more prominently pointed out in the documentation.
Sorting strings will produce results that is very confusing for humans.
I happens to work for ASCII, but will
New submission from Pierre Thierry :
In the documentation of the sqlite3 module, the return value for
Connection.execute() is told to be the Cursor that was implicitly created, but
nothing is said about the return value/type when using Cursor.execute().
--
components: Library (Lib
Pierre Fortin added the comment:
[Thanks for the replies! I was trying to post this before seeing them.]
Major egg on face...
The more complex the code becomes, the more likely you will be burned by a
rookie mistake...
var = ''
var[0] WILL give IndexError -- Duh!
It was bur
New submission from Pierre Fortin :
var = "u2"
var.strip()[0]
Works as expected, except that it returns IndexError (instead of "u") if used
in a list comprehension -- at least, that's where I found it. Attached example
script illustrates the issue.
Call it wit
New submission from Pierre Quentel :
In CPython 3.10 :
Python 3.10.0 (tags/v3.10.0:b494f59, Oct 4 2021, 19:00:18) [MSC v.1929 64 bit
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> @x = 123
File
Pierre Carbonnelle added the comment:
I can live with the workaround, so, you can close the issue if you wish. As
you say, maybe it's an issue with z3.
Thank you for your time.
--
___
Python tracker
<https://bugs.python.org/is
Pierre Carbonnelle added the comment:
As a work around, I had to use a temporary file (instead of a memory buffer):
print("outside:", sys.stdout.encoding)
with open("/tmp/log.txt", mode='w', encoding='utf-8') as buf:
with redirect_std
Pierre Carbonnelle added the comment:
I expect sys.stdout to have utf-8 encoding inside the redirect because the
buffer accepts unicode code points (not bytes), just as it does outside of the
redirect. In other words, I expect the 'encoding' attribute of sys.stdout to
have the
New submission from Pierre Carbonnelle :
The following code
print("outside:", sys.stdout.encoding)
with redirect_stdout(io.StringIO()) as f:
print("inside: ", sys.stdout.encoding)
print(f.getvalue())
yields:
outside: utf-8
inside: None
B
Pierre Quentel added the comment:
I found why len() is required, it's to avoid trying to match the subject (thus
consuming a part of it) if its length is less than the number of non-star
patterns, as explained in the PEP.
My mistake,
Pierre Quentel added the comment:
Oh, I did not invent this class, it is in the test script for pattern matching
:
https://github.com/python/cpython/blob/6948964ecf94e858448dd28eea634317226d2913/Lib/test/test_patma.py#L1932
With this class, [x, *_, y] matches, but not [x, *w, y] : this is
Pierre Quentel added the comment:
Thanks for the explanations, but I feel unconfortable with the fact that
variable-length sequence patterns are implemented the same as unpacking. (sorry
if this has been discussed before, I can't find references to the discussions
that lead to the cu
New submission from Pierre Quentel :
This code
match range(42):
case [x, *w, y]:
z = 0
sets w to a list with 40 items : the length of the subject, minus the number of
non-star subpatterns.
But this code (adapted from test_patma_186) enters an infinite loop
Pierre Quentel added the comment:
Sorry, I don't know C so I can't write a PR for this change.
--
___
Python tracker
<https://bugs.python.o
New submission from Pierre Quentel :
PEP 634 specifies that
"A mapping pattern may not contain duplicate key values. (If all key patterns
are literal patterns this is considered a syntax error; otherwise this is a
runtime error and will raise ValueError.)"
but this is not what ha
Pierre Ossman added the comment:
Also see Issue44185 for __exit__.
--
___
Python tracker
<https://bugs.python.org/issue44503>
___
___
Python-bugs-list mailin
New submission from Pierre Ossman :
I'd like to write this test case:
with patch('builtins.open') as pyopen:
mock_open(pyopen, read_data="foo")
run()
pyopen.assert_has_calls([call("filename", "wt"),
Change by Pierre Ossman :
--
nosy: +CendioOssman
___
Python tracker
<https://bugs.python.org/issue44185>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre added the comment:
A workaround consists in replacing fd(0) with /dev/tty without modifying
sys.stdin
import os
stdin = os.dup(0)
os.close(0)
tty = os.open("/dev/tty", os.O_RDONLY)
assert tty == 0
import readline
print("input:", input())
print("
Pierre added the comment:
Please, let me know if I should re-open a new bug for this one.
--
___
Python tracker
<https://bugs.python.org/issue512981>
___
___
New submission from Pierre Quentel :
In the simplified version of Python grammar at
https://docs.python.org/3.10/reference/grammar.html, most 'invalid_' from
the complete grammar at
https://github.com/python/cpython/blob/3.10/Grammar/python.gram have been
removed, but 2 of t
Pierre Ossman added the comment:
I've always been cautious about running patch() manually since it was easy to
miss the cleanup. But those fears might be irrelevant these days when we have
addCleanup().
Still, decorators are a more robust in more complex setups since you don'
New submission from Pierre Ossman :
Right now if you use unittest.mock.patch() as a decorator it may or may not
pass the object as an argument to the test function. The behaviour is a side
effect of the argument "new" rather than something the caller can explicitly
control.
In
Pierre added the comment:
I suggest to reopen this issue as there was a regression with python3.
import sys
sys.stdin = open("/dev/tty", "r")
import readline
print(input())
Write some text and press left.
Expected: the cursor goes left.
Actual: prints '^[[D
Pierre-Alain Moret added the comment:
The DICOM format is indeed very widely used in the medical field and for me it
deserves to be added in stdlib. I do not see why it is more specific than rast
format which is included. Moreover it should be easy to add because even if the
complete format
Change by Pierre Tardy :
--
pull_requests: +22953
status: pending -> open
pull_request: https://github.com/python/cpython/pull/24122
___
Python tracker
<https://bugs.python.org/issu
New submission from Pierre Tardy :
original bug report: https://github.com/buildbot/buildbot/issues/5743
Twisted by default advertises its algorithm in lowercase, which is uncommon,
but allowed by the spec.
https://tools.ietf.org/html/rfc3230#section-4.1.1
python's request.py is
Change by Pierre Tardy :
--
components: +Library (Lib)
status: open -> pending
___
Python tracker
<https://bugs.python.org/issue42833>
___
___
Python-bugs-lis
Pierre Ossman added the comment:
autospec's behaviour for methods is currently needed to work around Issue42556,
so be careful with any fixes here so they don't break that workaround.
--
nosy: +CendioOssman
___
Python track
New submission from Pierre Ossman :
unittest.mock.patch() as it currently works cannot properly mock a method as it
currently replaces it with something more mimicking a function. I.e. the
descriptor magic that includes "self" isn't properly set up.
In most cases this doesn&
Pierre van de Laar added the comment:
Not a bug: tuple is an iterator but an iterator is not a tuple.
Yet iterators are often accepted during initialization...
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
_
Pierre van de Laar added the comment:
Zip didn't contain the test cases from the tests directory (sorry for that)
--
Added file: https://bugs.python.org/file49592/tests.zip
___
Python tracker
<https://bugs.python.org/is
New submission from Pierre van de Laar :
On windows, with python 3.9, with unittests,
My test case fails when I use the following lines of code
```
result = map(lambda x: self.substitute_in_expression(x),
sequence.sequence)
```
It works fine with
```
result = list()
for x
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +17643
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/18266
___
Python tracker
<https://bugs.python.org/issu
New submission from Pierre Glaser :
The new Pickler reducer_override mechanism introduced in `Python3.8` generates
a reference cycle: for optimization purposes, a the pickler.reducer_override
bound method is referenced into the reducer_override attribute of the Pickler's
struct. Thus,
Change by Pierre Chatelier :
--
versions: +Python 3.8 -Python 3.6
___
Python tracker
<https://bugs.python.org/issue32371>
___
___
Python-bugs-list mailin
Pierre Chatelier added the comment:
Aaand finally there is still something : it depends on the call context. Once
in a C++/CLI class, the link bug occurs again.
Here is attached a minimal project.
--
status: closed -> open
Added file: https://bugs.python.org/file48721/PythonFromC.
Pierre Chatelier added the comment:
Just reproduced and solved it at the same time !
It happened with Debug build, where I linked to pythonxx.lib instead of
pythonxx_d.lib, because I did not download the debug binaries.
Ultimately : my fault
Pierre Chatelier added the comment:
Can't reproduce any more.
It might have been specific to the Visual Studio version I used at that time.
--
___
Python tracker
<https://bugs.python.org/is
Pierre Quentel added the comment:
That was a quick fix, thanks !
--
___
Python tracker
<https://bugs.python.org/issue38469>
___
___
Python-bugs-list mailin
New submission from Pierre Quentel :
PEP 572 says that "an assignment expression occurring in a (...) comprehension
(...) binds the target in the containing scope, honoring a nonlocal or global
declaration for the target in that scope, if one exists."
In Appendix B, the PEP
Pierre Quentel added the comment:
Now that the PR has been merged, can someone close the issue ?
--
___
Python tracker
<https://bugs.python.org/issue20
Pierre Quentel added the comment:
@ethan.furman
Yes, in test_cgi.py, the method test_fieldstorage_multipart_w3c
https://github.com/python/cpython/blob/master/Lib/test/test_cgi.py#L316) uses a
multipart content with 2 files in it
(https://github.com/python/cpython/blob/master/Lib/test
Pierre-Jean Grenier added the comment:
The PR went through review and has been awaiting core review for almost a
month, anyone to have a look at it? :)
--
___
Python tracker
<https://bugs.python.org/issue37
Pierre Quentel added the comment:
The patch has been applied some time ago (I couldn't find the exact commit),
cf. https://github.com/python/cpython/blob/master/Lib/cgi.py#L750
I think we can close the issue.
--
nosy: +quentel
___
Python tr
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +15524
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15883
___
Python tracker
<https://bugs.python.org/issu
Change by Pierre Glaser :
--
pull_requests: +15523
pull_request: https://github.com/python/cpython/pull/15882
___
Python tracker
<https://bugs.python.org/issue38
Pierre Glaser added the comment:
> Dropping this into Lib/multiprocessing/spawn.py should cause a repro:
if WINSERVICE:
_python_exe = os.path.join(sys.exec_prefix, 'python.exe')
else:
_python_exe = getattr(sys, '_base_executable', sys.ex
New submission from Pierre Glaser :
If I am not mistaken, when creating a new process on Python3.7 and later on
Windows, if using a virtualenv, Python now uses a launcher. The launcher is
being notified that it must create a virtual-environment Python (and not a
system Python) program using
Change by Pierre-Jean Grenier :
--
keywords: +patch
pull_requests: +15108
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/15401
___
Python tracker
<https://bugs.python.org/issu
New submission from Pierre-Jean Grenier :
The module tarfile contains some methods for knowing whether an archive member
is a regular file/a directory/a symlink. Apart from an "is_dir()" method, there
was nothing alike in the zipfile module. For an on-going project, I needed to
kn
Change by Pierre Glaser :
--
pull_requests: +14807
pull_request: https://github.com/python/cpython/pull/15058
___
Python tracker
<https://bugs.python.org/issue28
Pierre Glaser added the comment:
Sure, although I won't be able to merge it. Make sure you ping a core-dev such
as pitrou or davin :-)
--
___
Python tracker
<https://bugs.python.org/is
Pierre Glaser added the comment:
The root of the error is that struct.pack_into starts by memsetting the
underlying memory area with NULL bytes before filling the data with memcpy. If
ShareableList._get_packing_format is called between the two operations (through
a concurrent __getitem__
Change by Pierre Chopin :
--
pull_requests: +14651
pull_request: https://github.com/python/cpython/pull/14862
___
Python tracker
<https://bugs.python.org/issue16
Pierre Chopin added the comment:
This is actually a duplicate of bpo-16512, i am closing this.
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.or
New submission from Pierre Chopin :
the imghdr library only checks for the presence of (b'JFIF', b'Exif') in the
header, which is excluding some valid JPEG file. This is an example of not
recognised ile
--
files: e2006bd7-51d7-4554-9738-ea13207fd104.jpg
messages:
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +14319
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/14503
___
Python tracker
<https://bugs.python.org/issu
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +14110
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/14288
___
Python tracker
<https://bugs.python.org/issu
Change by Pierre Glaser :
--
pull_requests: +14108
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/14286
___
Python tracker
<https://bugs.python.org/issu
New submission from Pierre Glaser :
Hi,
Following https://bugs.python.org/issue26836, I started thinking about using
memfd_create instead of shm_open for creating shared-memory segments in
multiprocessing.shared_memory.
The main advantage of memfd_create over shm_open is that the generated
Pierre Glaser added the comment:
>From a quick skim at the man page of memfd_create, this looks promising.
--
___
Python tracker
<https://bugs.python.org/issu
Change by Simon Bernier St-Pierre :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue36686>
___
__
Change by Simon Bernier St-Pierre :
--
keywords: +patch
pull_requests: +13493
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/13586
___
Python tracker
<https://bugs.python.org/issu
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +13360
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36977>
___
___
Py
New submission from Pierre Glaser :
The new multiprocessing.managers.SharedMemoryManager spawns a server that
delivers memory segments to a parent Python process. If the parent process
terminates unexpectedly, we should now make the manager process notice this
termination it using the recent
Pierre Glaser added the comment:
Just did so.
--
___
Python tracker
<https://bugs.python.org/issue36950>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +13318
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36950>
___
___
Py
Pierre Glaser added the comment:
Lib/test/test_asyncio/utils.py defines a similar helper:
def run_until(loop, pred, timeout=30):
deadline = time.monotonic() + timeout
while not pred():
if timeout is not None:
timeout = deadline - time.monotonic()
if
Change by Pierre Glaser :
--
nosy: +pierreglaser
___
Python tracker
<https://bugs.python.org/issue36950>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Glaser :
--
nosy: +pierreglaser
___
Python tracker
<https://bugs.python.org/issue24882>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Glaser :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue35933>
___
___
Pyth
Change by Pierre Glaser :
--
stage: patch review -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue36368>
___
___
Pyth
Pierre Glaser added the comment:
Thanks for the fix Antoine.
--
___
Python tracker
<https://bugs.python.org/issue36894>
___
___
Python-bugs-list mailin
Change by Pierre Glaser :
--
pull_requests: +13203
___
Python tracker
<https://bugs.python.org/issue36867>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Glaser added the comment:
We can do that, or maybe we can try to wait on the `resource_tracker's` pid?
--
___
Python tracker
<https://bugs.python.org/is
Change by Pierre Glaser :
--
pull_requests: +13182
___
Python tracker
<https://bugs.python.org/issue36867>
___
___
Python-bugs-list mailing list
Unsubscribe:
Pierre Glaser added the comment:
Actually, I was properly unlinking the shared_memory segments. The warning
messages are due to bad interactions between the ResourceTracker and the
SharedMemoryManager object. In this particular case, it's easy to change a
little bit the problematic te
Pierre Glaser added the comment:
Yes, one test I wrote in an unrelated commit does not unlink a memory segment.
Now the ResourceTracker complains. Fixing it now.
--
___
Python tracker
<https://bugs.python.org/issue36
Pierre Glaser added the comment:
Shared memory segments are now tracked by the brand new resource_tracker!
Thanks Antoine for the review.
Does anyone have an opinion on introducing a public API for users to make the
resource_tracker track resources of their choice?
What We have in mind is
Change by Pierre Glaser :
--
pull_requests: +13146
___
Python tracker
<https://bugs.python.org/issue36338>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Pierre van de Laar :
I would like to add information to CDATA in an Xml Tree.
Turns out I am not the only one:
https://stackoverflow.com/questions/174890/how-to-output-cdata-using-elementtree
Can the library be extended to also support CDATA (similar to Comment)?
Saves a
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +13132
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36867>
___
___
Py
New submission from Pierre Glaser :
Hi all,
Olivier Grisel, Thomas Moreau and myself are currently working on increasing
the range of action of the semaphore_tracker in Python.
multiprocessing.semaphore_tracker is a little known module, that launches a
server process used to track the life
Simon Bernier St-Pierre added the comment:
Could be cool to also mention that `encoding` / `errors` does not work yet.
https://bugs.python.org/issue31087
--
___
Python tracker
<https://bugs.python.org/issue36
Change by Simon Bernier St-Pierre :
--
stage: -> resolved
status: open -> closed
___
Python tracker
<https://bugs.python.org/issue36687>
___
___
Pyth
Change by Simon Bernier St-Pierre :
--
nosy: sbstp
priority: normal
severity: normal
status: open
title: subprocess encoding
___
Python tracker
<https://bugs.python.org/issue36
New submission from Simon Bernier St-Pierre :
I had trouble figuring out how to simply inherit stdin, stdout, or stderr in
the asyncio.create_subprocess_exec / asyncio.subprocess_exec docs. My
experiments show that passing either None or `sys.std*` works but the way the
docs are written make
Change by Pierre Glaser :
--
pull_requests: +12530
___
Python tracker
<https://bugs.python.org/issue35900>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Glaser :
--
pull_requests: +12526
___
Python tracker
<https://bugs.python.org/issue36338>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Glaser :
--
pull_requests: +12525
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36338>
___
___
Python-bugs-list mai
Change by Pierre Glaser :
--
pull_requests: +12449
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue35900>
___
___
Python-bugs-list mai
Pierre Glaser added the comment:
Done.
--
___
Python tracker
<https://bugs.python.org/issue36368>
___
___
Python-bugs-list mailing list
Unsubscribe:
Change by Pierre Glaser :
--
pull_requests: +12436
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36368>
___
___
Python-bugs-list mai
Change by Pierre Glaser :
--
keywords: +patch
pull_requests: +12435
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36338>
___
___
Py
New submission from Pierre Glaser :
When starting a SharedMemoryManager in an interactive session, any
KeyboardInterrupt event will be transmitted to the (sub)process running the
shared memory server, which causes the Manager to be unusable thereafter:
>>> from multiprocessing
Change by Pierre Glaser :
--
pull_requests: +12394
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue36364>
___
___
Python-bugs-list mai
New submission from Pierre Glaser :
The examples of the new shared_memory module using SharedMemoryManager try to
import the class from multiprocessing.shared_memory instead of
multiprocessing.managers, making them fail.
--
assignee: docs@python
components: Documentation
files: 0001
Pierre Glaser added the comment:
Update:
Instead of changing permission on some attributes of function objects
(__globals__ and __closure__), we added an optional argument called
state_setter to save_reduce. This expects a callable that will be saved inside
the object's pickle string
Pierre Glaser added the comment:
I added a PR with a small patch to document this behavior and reconcile
_pickle.c and pickle.py
Some explanations on why I am pushing this forward:
Pickling instances of classes/subclasses with slots is done natively for pickle
protocol >= 2. Mention
1 - 100 of 281 matches
Mail list logo