Martin Panter added the comment:
The current exception seems to give a reasonable hint:
>>> subprocess.Popen((executable,), stdout=BytesIO())
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.5/subprocess.py", line 914, in __init__
Martin Panter added the comment:
I think the documentation should be fixed to say choices overrides dest, and
the implementation should be left alone. Even if the documentation is not a
“formal module reference”, it should not be wrong or misleading.
Also, Issue 14039 is related, about
Martin Panter added the comment:
Thanks to Issue 11807, the documentation now lists “metavar”. (However, it
looks like a positional argument, rather than keyword-only, and its use seems
to be discouraged, but those issues are not specific to “metavar”.)
Some points specific to “metavar
Martin Panter added the comment:
The magical no-argument call could also be clarified:
8. Define in the main text what happens when you omit the first argument (the
subclass) to “super”. At the moment, I think the reader could infer that it is
the method’s class, but this is only hinted
Martin Panter added the comment:
In Issue 23674, I posted a patch that changes to consistent parameter names
(subclass, self). The exception message would avoid “type”, becoming
super(subclass, self): self must be an instance or subtype of subclass
--
nosy: +martin.panter
Martin Panter added the comment:
I don’t have a strong opinion on adding the missing parameters to the one-shot
“compress” function, though it does seem beneficial to have a consistent set of
parameters supported across the relevant APIs
Martin Panter added the comment:
It looks like the zip entry writer object may not expect its “close” method to
be called multiple times. Other file objects tend to allow this with no ill
effect. Adding Serhiy and Thomas who implemented the writer object in Issue
26039.
The first time
Martin Panter added the comment:
Raphael: Can you point to the implementation code that handles file objects
without a file descriptor (or give a demonstration of it)? I suspect there is
no such support and you are mistaken.
Perhaps we can instead clarify in the “subprocess” documentation
Martin Panter added the comment:
I agree this is not a bug. It is just one of the unfortunate compatibility
breaks between Py 2 and 3. Mode="rt" is not one of the values that are
supported according to the documentation; adding support would be a new feature.
I understand the
Martin Panter added the comment:
Not in general. I think you would have to make special cases for partial
functions, __wrapped__, and whatever else there is, and combinations of these.
It would be very hard to determine the correct result for test2 in
test2 = lambda: test(a=10) # test2
Martin Panter added the comment:
Looks like a duplicate of Issue 29353, which has a more complete patch
proposed. However, see my comment about a problem with using heartersonly=True.
My policy-flag.v2.patch for Issue 24363 may help (the details have faded from
my mind, but I suspect
Martin Panter added the comment:
Doesn't seem like a bug to me.
Even if there was special support for "partial" objects, that won't help with
other ways of producing the same sort of thing.
test2 = functools.partial(test, a=10)
@functools.wraps(test)
def test2():
return test(a
Martin Panter added the comment:
FWIW I don’t see any error in the first quote. “Should X happen, Y happens” is
valid English. Though I admit this kind of grammar is not used that often.
If it is too hard to understand, it should be okay to change it to “If it
becomes a danging pointer
Martin Panter added the comment:
I think he means make something like the following legal, where dots (.)
indicate space characters:
a.=.\.
b
At the moment it is a SyntaxError:
>>> a = \
File "", line 1
a = \
^
SyntaxError: unexpected character afte
Martin Panter added the comment:
I had mainly been using my boot-flag.patch with BSD Make (bmake) rather than
Gnu Make. It seems I was relying on a bug in BSD Make that merges escaped
newlines in command lines, despite Posix and Gnu Make. Anyway, Chi’s fix seems
appropriate.
I am posting
Changes by Martin Panter <vadmium...@gmail.com>:
Added file: http://bugs.python.org/file46773/boot-flag.py2.patch
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Martin Panter added the comment:
I think this is the same underlying problem as Issue 23404. Either we get “make
touch” working without Mercurial, or we use some other mechanism to either
disable regeneration by default (my preference), or disable regeneration by
explicit request (possible
Martin Panter added the comment:
BTW pthread_kill was only added to Python 3.3, so is not available for Python
2. I’m not sure what the best fix for 2.7 would be. Maybe it’s not worth it, or
maybe you can find another way to a signal to the user process or its main
thread without interfering
Martin Panter added the comment:
Hi Terry, this patch is what I imagined a fix would look like for Linux. I am
not familiar with Idle (internally nor externally), so there may be
improvements you can make.
It works as I expected for normal blocking functions and a tight “for” loop
Martin Panter added the comment:
We could change this to a documentation issue if you have any suggestions to
make the documentation clearer.
I understand the “time” module is mainly a wrapper or emulator of the OS’s own
strptime, mktime, etc functions, which explains some of these quirks
Martin Panter added the comment:
As far as I can see, the documentation only claims that “mktime” converts local
time. If you saw a suggestion that it supports arbitrary time zones, please
point it out.
--
___
Python tracker <rep...@bugs.python.
Martin Panter added the comment:
Are you sure? It works for me:
>>> strptime("+0200", "%z").tm_gmtoff
7200
>>> strptime("+", "%z").tm_gmtoff
0
The "struct_time" class is documented as a named tuple, but the time zone
o
Martin Panter added the comment:
By “factory instance”, I presume you just mean a function (or class or method)
that returns an appropriate object when called. (I think these are normally
called “factory functions”. Instances are objects, the things that class
constructors and factories
Martin Panter added the comment:
Underscores are only applicable to 3.6+, but the original concern about leading
zeros applies to 3.5.
On Git Hub I suggested dropping the details and just referring to the Lexical
Analysis section
<https://docs.python.org/3.5/reference/lexical_analysis.h
Martin Panter added the comment:
The pull request currently suggests “All of Python’s immutable built-in objects
are hashable; mutable containers (such as lists or dictionaries) are not.” This
seems better wording than the original.
FWIW, I would have tried “Python’s built-in immutable
Changes by Martin Panter <vadmium...@gmail.com>:
--
nosy: -martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27867>
___
Changes by Martin Panter <vadmium...@gmail.com>:
--
nosy: -martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue28556>
___
Changes by Martin Panter <vadmium...@gmail.com>:
--
nosy: -martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue27100>
___
Martin Panter added the comment:
In this test, “keyword arguments” is definitely wrong:
>>> f(**{1:2})
-TypeError: f() keywords must be strings
+TypeError: f() keyword arguments must be strings
To me, a keyword argument is a _value_ passed in using the f(name=. . .)
syntax, and th
Martin Panter added the comment:
When I wrote the documentation
<https://docs.python.org/dev/reference/lexical_analysis.html#f-strings>, I
think I tried to avoid “f-string”, being jargon, and used more formal
terminology from PEP 498 instead. But I agree they more than regular li
Martin Panter added the comment:
I don’t know if it is an implementation detail or not. Maybe it is the
documentation itself which defines that. Anyway, I think your wording would
have been fine for my original problem.
I wonder if we should clarify that only reading the mapping is supported
Martin Panter added the comment:
See also Issue 27425, about making the deletion step more flexible after the
file has been created, which might help here.
I’m not sure about security problems, but IMO failure to remove a temporary
file (because it is already gone, or some other reason
Changes by Martin Panter <vadmium...@gmail.com>:
--
title: Problem with tempfile.NamedTemporaryFile -> tempfile.NamedTemporaryFile:
automatic cleanup by OS
___
Python tracker <rep...@bugs.python.org>
<http://bugs.py
Martin Panter added the comment:
Hi Victor, I’m not sure about changing the data type. As Python 3 grows older,
there is potentially more code being written that you break by fixing a bug
like this. It is incompatible if you used to write
>>> print(struct.Struct('hi').format.decode
Martin Panter added the comment:
The double equals "==" case for the “quopri” implementation in Python is now
consistent with the others thanks to the fix in Issue 23681 (see also Issue
21511).
According to Issue 20121, the quopri (Python) implementation only supports LF
(\n)
Martin Panter added the comment:
This seems to be discussing the same sort of stuff that ended up with the Issue
1602 implementation.
--
nosy: +martin.panter
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> windows console doesn't pr
Martin Panter added the comment:
I presume you are trying to print to the normal Windows console. I understand
the console was not well supported until Python 3.6 (see Issue 1602). Have you
tried that version?
I’ll leave this open for someone more experienced to confirm, but I suspect
what
Martin Panter added the comment:
For the native alignment case (prefix code @), perhaps you can already use the
“ctypes” module, which supports structures with more complicated embedded
fields.
For the the unaligned modes (prefixes =, <, > and !), I am a little
sympathetic. In the p
Martin Panter added the comment:
A backwards-compatible way forward would be to preserve (and document) the
“format” attribute as a byte string, and add a new attribute which is
definitely a text string. Not sure of a good name; perhaps “Struct.text_format”
or “format_str” is a start
Martin Panter added the comment:
This seems too obscure to be worth supporting in the built-in library IMO. The
use case loses one line of code but gains a more complicated structure format
string.
--
nosy: +martin.panter
___
Python tracker <
Martin Panter added the comment:
If you enable BytesWarning (python -b) you do get an error:
>>> urlopen(req, data)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.5/urllib/request.py", line 162, in urlopen
return opener.op
Martin Panter added the comment:
Gnu Readline comes includes its own documentation (e.g.
/usr/share/info/history.info.gz on my computer). It is also at
<https://cnswww.cns.cwru.edu/php/chet/readline/history.html>.
Perhaps the history_base value is relevant; see some of the comments st
Changes by Martin Panter <vadmium...@gmail.com>:
--
superseder: -> Make libedit support more generic; port readline / libedit to
FreeBSD
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
Changes by Martin Panter <vadmium...@gmail.com>:
--
resolution: -> duplicate
stage: patch review -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<http://bu
Martin Panter added the comment:
Closing in favour of Issue 13501, since the report was apparently about using a
non-Apple Editline rather than Gnu Readline. However see also Issue 29854,
where the same symptom is seen with Gnu Readline, and it will probably get the
same fix
Martin Panter added the comment:
Does the “astimezone” method work for you?
<https://docs.python.org/3.5/library/datetime.html#datetime.datetime.astimezone>
>>> from datetime import *
>>> aedt = timezone(+timedelta(hours=11))
>>> local = datetime.now(aedt)
&g
Martin Panter added the comment:
Marien’s pull request is for 2.7 and adds two new paths when raw_input is
called:
* On Linux (actually glibc), use “poll” rather than “select”
* In other cases, if sys.stdin cannot be used with “select”, raise ValueError
Marien admits that even in the best
Martin Panter added the comment:
I agree with Josh. This is how it is supposed to work.
os.system calls the shell (e.g. Bash) rather than running the "ls" program
directly. Unix shells translate "~" to the home directory (as well as
translating a lot of other stuff, e.g
Martin Panter added the comment:
Perhaps a duplicate of Issue 1043134?
--
nosy: +martin.panter
superseder: -> Add preferred extensions for MIME types
versions: -Python 3.3, Python 3.4
___
Python tracker <rep...@bugs.python.org&
Martin Panter added the comment:
If you ignore the c[0] argument, the rest looks fine to me. See the
documentation at
<https://docs.python.org/2/reference/expressions.html#binary-arithmetic-operations>
and
<https://docs.python.org/2/library/stdtypes.html#numeric-types-int-float-lon
Martin Panter added the comment:
FWIW I tend to use cStringIO.StringIO as a Python 2 replacement for io.StringIO
to avoid this str vs unicode problem. But that only accepts ASCII, so won't
help you if you really need the UTF-8 encoding step.
--
nosy: +martin.panter
Martin Panter added the comment:
The “tabnanny” script was removed from Tools/scripts/ in 2.0:
<https://github.com/python/cpython/commit/a02c898>. So the 2.7 FAQ also has the
wrong location.
--
___
Python tracker <rep...@bugs.python.o
Martin Panter added the comment:
Also see Issue 26602 and Issue 11176, each with patches. Perhaps you could help
review and combine them.
--
nosy: +martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Martin Panter added the comment:
The patch looks unfinished. I left some narrow nit-picky review comments, but I
haven’t really thought about the problem from a high level.
--
nosy: +martin.panter
stage: -> patch review
versions: +Python 2.7, Python 3.5, Python 3.6, Python
Changes by Martin Panter <vadmium...@gmail.com>:
--
resolution: -> works for me
stage: needs patch -> resolved
status: open -> closed
___
Python tracker <rep...@bugs.python.org>
<http://bu
Martin Panter added the comment:
Max, I’m not sure if you saw the double-dash (--) workaround. IMO that is the
“correct” way to do this for Unix command lines, and for the current version of
“argparse”. But I guess that may be too inconvenient for your Morse Code case.
Perhaps you can write
New submission from Martin Panter:
I think the RequestTests class really belongs in test_urllib2, which already
has a RequestHdrsTests class testing these APIs.
BTW test_urllib.py (no 2) is mainly for testing the stuff that came from Python
2’s “urllib” module, but the Request class
Martin Panter added the comment:
I don’t think so. It is best to avoid a new exception type (even a subclass) in
a bug fix. That would break code which checks “type(exc) == BadStatusLine” or
similar.
Specific exception messages are supposed to be implementation details, and the
current
Martin Panter added the comment:
This change was only made in 2.7a4, not 2.6
--
versions: +Python 2.7 -Python 2.6
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/
Changes by Martin Panter <vadmium...@gmail.com>:
--
resolution: -> fixed
stage: -> test needed
status: open -> pending
___
Python tracker <rep...@bugs.python.org>
<http://bu
Martin Panter added the comment:
Issue 29788 proposes an option to disable the vulnerability in the CLI
--
dependencies: +tarfile: Add absolute_path option to tarfile, disabled by default
___
Python tracker <rep...@bugs.python.org>
Martin Panter added the comment:
The CLI was added in Issue 13477. I didn’t see any discussion of traversal
attacks there, so maybe it was overlooked. Perhaps there should also be a
warning, like with the Tarfile.extract and “extractall” methods.
However I did see one of the goals was to keep
Martin Panter added the comment:
One other difference between 2 and 3 is that Python 3 has two kinds of “binary”
files. In most cases, a subset of the BufferedIOBase API is assumed, which does
“exact” reads and writes. I understand this is how Python 2 files worked. But
there is also
Martin Panter added the comment:
I agree that it would be better to hold off deprecating codecs.open until
Python 2 is no longer supported. This deprecation also discussed in Issue 8796.
There is more to compatability than the missing attributes. The most obvious
one to me
Changes by Martin Panter <vadmium...@gmail.com>:
--
components: +asyncio
stage: -> patch review
versions: +Python 3.6, Python 3.7
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
Changes by Martin Panter <vadmium...@gmail.com>:
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> asyncio.wrap_future undocumented
___
Python tracker <rep...@bugs.python.org>
<http:/
Martin Panter added the comment:
My guess is this is supposed to emulate (or is actually the implementation of)
the "int" constructor and the Python syntax. In these cases, numbers with
leading zeros are disallowed. This was to help with Python 2 porting, where a
leading zero
Martin Panter added the comment:
What is the use case? Unless changing the behaviour would be useful, I think
the simplest solution would be to document that the methods should only be
given instances of “int”, so that it is clear that other kinds of numbers are
unsupported.
--
nosy
Martin Panter added the comment:
“Input9)” is probably a typo for “input()”.
In Python 2, sys.stdin etc are by default wrappers around ’s “stdin”
etc, and can easily be wrappers around other FILE objects, so the
PyOS_Readline API and Python’s “readline” module pass these objects
directly
Martin Panter added the comment:
This is actually expected behaviour of the “argparse”, as well as general Unix
CLI programs. See the documentation
<https://docs.python.org/3.6/library/argparse.html#arguments-containing>. The
general workaround is to use a double-dash sep
Martin Panter added the comment:
See also Issue 26264 about the “keyword” module
--
nosy: +martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Martin Panter added the comment:
Be careful, some OSes have limited support for “poll”, “kqueue”, etc with
terminals, and I ended up using “select” in the test suite:
https://bugs.python.org/issue26870#msg265604
https://github.com/python/cpython/commit/79f561d126d09d6d7ea1457a2a6ef267d93e6448
Martin Panter added the comment:
It's not clear what you expected the behaviour to be. A function cannot both
raise an exception and return a value.
In any case, you are correct in saying "the next option, '-d', is taken as the
argument." I do not think this is a bug.
Martin Panter added the comment:
Matthias’s proposal adds support for a new keyword-only “exc” argument:
print_exception(exc=exception_instance)
I still think it is worth supporting a single positional argument as well:
print_exception(exception_instance)
Another point is that it may
Martin Panter added the comment:
It looks like you are trying to tunnel one SSL or TLS connection through
another SSL/TLS connection (instead of through a plain OS socket). There is
already a bug recently opened about this: Issue 29394.
Basically, the SSL module doesn’t support
Changes by Martin Panter <vadmium...@gmail.com>:
--
stage: -> needs patch
versions: +Python 2.7, Python 3.5, Python 3.7
___
Python tracker <rep...@bugs.python.org>
<http://bugs.pyt
Martin Panter added the comment:
Matthias’s proposal sounds reasonable to me. There is a minor disadvantage that
it will exceed the width of an 80-character terminal:
UnboundLocalError: local variable 'x' referenced before assignment, or got delet
ed
But I don’t think the wrapping is a big
Martin Panter added the comment:
The second example seems like the original complaint in Issue 25612. That
spawned a separate bug related to the first situation, which was later closed:
Issue 25683.
--
nosy: +martin.panter
type: -> behav
Martin Panter added the comment:
The file position is often useful when the cleanup is deterministic. Example:
def f1():
file1 = open("/dev/null")
def f2():
file2 = open("/dev/null")
del file2 # ResourceWarning
f1() # ResourceWarning at function exit
f2()
Martin Panter added the comment:
You say that the line number is incorrect. What would you consider a correct
line number to be?
Let me try again to explain my theory about garbage collection and reference
cycles. Perhaps you have two objects a and b, linked such that a.x = b and b.y
Martin Panter added the comment:
Looks like the tests should run if the data is already downloaded. First run
needs -u urlfetch. My guess is your data is somehow corrupted. Check out your
copy of the files in Lib/test/data/, compare them to e.g.
<http://www.pythontest.net/hashlib/blake2b.
Martin Panter added the comment:
Without more information about what the relevant code is and why you think the
line number is wrong, my best guess is you may not realize how the
ResourceWarning is emitted. It happens when the garbage collector runs and
destroys the socket object, which
Martin Panter added the comment:
Sounds related to Issue 22239
--
nosy: +martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Martin Panter added the comment:
I suggest to close this as not a bug.
--
resolution: -> not a bug
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.or
Martin Panter added the comment:
This is similar to the problem of building a list by repeating one item:
<https://docs.python.org/2.7/faq/programming.html#how-do-i-create-a-multidimensional-list>.
With dict.fromkeys(), the resulting dictionary maps each specified key object
to t
Martin Panter added the comment:
Diff showing what changed relative to the main 3.5 branch when merging in the
3.5.2 release: <https://hg.python.org/cpython/rev/31a2a278dc85:1f8938164809>.
There are four news entries deleted from the 3.5.2rc1 section. Ideally they
should have been
Changes by Martin Panter <vadmium...@gmail.com>:
--
dependencies: +Tabs vs spaces FAQ out of date
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python
Martin Panter added the comment:
Jim, regarding Doc/faq/windows.rst, this warning lead me to open Issue 29387.
We already have discussed a patch for that, and I think it is ready to commit
(when it gets to the top of my list, if nobody else beats me to it).
Regarding Misc/NEWS, I think I
Martin Teichmann added the comment:
I added a solution to this problem. I just silence the bad error message by
overwriting _GatheringFuture.__del__ to do nothing. This may have undesired
side effects, though.
--
___
Python tracker <
Martin Panter added the comment:
Please explain what the wrong behaviour that you see is, and what you expect
the right behaviour should be.
That code is intended to either keep any user-supplied Accept-Encoding header
field, or send “Accept-Encoding: identity” if the field is not supplied
New submission from Martin Panter:
By default, the email package turns single-line header fields into multi-line
ones to try and limit the length of each line. The documentation
<https://docs.python.org/release/3.5.2/library/email.policy.html#email.policy.Policy.max_line_length>
Martin Panter added the comment:
>>> datetime.now().strftime("%x")
'02/06/17'
>>> from locale import setlocale, LC_TIME
>>> setlocale(LC_TIME)
'C'
>>> setlocale(LC_TIME, "en_US.utf8")
'e
Martin Panter added the comment:
Have you tried enabling the locale with locale.setlocale()? I believe Python
only enables LC_CTYPE by default, so other locale aspects like LC_TIME won’t
work until they are enabled.
--
nosy: +martin.panter
Changes by Martin Panter <vadmium...@gmail.com>:
--
components: +Windows
stage: test needed -> needs patch
title: subprocess.Popen(cwd) documentation -> subprocess.Popen(cwd)
documentation: Posix vs Windows
___
Python tracker <rep...@
Martin Panter added the comment:
Perhaps this is a duplicate of Issue 8557
--
nosy: +martin.panter
___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/i
Martin Panter added the comment:
Marco: I agree “Python reports an error” would have been simpler. That is what
I meant to say. Anyway, perhaps we should put
Python raises :exc:`IndentationError` if mixed tabs and spaces are causing
problems in leading whitespace.
In general, the exception
Changes by Martin Panter <vadmium...@gmail.com>:
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> subprocess.Popen(cwd) documentation
___
Python tracker <rep...@bugs.python.org>
Martin Panter added the comment:
It is hard to make sense of this without decoding your URLs, downloading the
repository and finding the relevant commit. Anyway, what you have posted sounds
like a duplicate of Issue 8557.
--
nosy: +martin.panter
resolution: -> duplicate
st
Changes by Martin Panter <vadmium...@gmail.com>:
--
title: Subprocess picks the wrong executable on Windows -> Subprocess searches
special directories before PATH on Windows
___
Python tracker <rep...@bugs.python.org>
<http
Martin Panter added the comment:
Not a big deal, but the change produces compiler warnings with GCC 6.1.1:
/home/proj/python/cpython/Objects/bytesobject.c: In function ‘bytes_subscript’:
/home/proj/python/cpython/Objects/bytesobject.c:1701:13: warning: ‘slicelength’
may be used uninitialized
601 - 700 of 9608 matches
Mail list logo