paul j3 added the comment:
This call used to be
namespace, arg_strings = parser.parse_known_args(arg_strings, namespace)
But in 2014 (2.7.9) http://bugs.python.org/issue9351 was implemented
As noted in the title and comment in the code, the idea was to give more power
to the defaults set
paul j3 added the comment:
I've posted a file that runs your code as you expect.
It uses a custom Action class (like your test case). It subclasses
._SubParsersAction, and replaces the 9351 namespace use with the original one.
I use the registry to change the class
paul j3 added the comment:
In http://bugs.python.org/issue27859 I've demonstrated how a subclass of
_SubParsersAction can be used to revert the behavior to pre 2.7.9, passing the
main namespace to the subparser.
The only other change is to the parser registry:
parser.register(
Changes by paul j3 :
--
Removed message: http://bugs.python.org/msg274336
___
Python tracker
<http://bugs.python.org/issue9351>
___
___
Python-bugs-list mailin
Paul Moore added the comment:
In the light of Steve Dower's work to "un-deprecate" bytes paths, I agree this
should be added.
--
___
Python tracker
<http://bugs.pyt
paul j3 added the comment:
Clint, 'nargs=argparser.REMAINDER' ('...') may do what you want
p=argparse.ArgumentParser()
p.add_argument('--subscipt_args', nargs='...')
p.add_argument('pos',nargs='*')
p.parse_
Paul Moore added the comment:
You can actually handle this already, with a simple wrapper program (based on
the one in PC\WinMain.c):
/* Minimal main program -- everything is loaded from the library. */
#include "Python.h"
#define WIN32_LEAN_AND_MEAN
#include
int wmain()
{
Paul Moore added the comment:
I'd prefer not to hard code __main__.py, as I'd quite like to be able to have a
number of copies of the executable, each running its own script. (I foresee
putting all my little Python utility scripts in a directory with a Python
installation an
paul j3 added the comment:
Clint, the problem is the argparse uses different argument allocation method
than optparse.
optparse gives the '--subscipt_args` Action all of the remaining strings, and
says - 'consume what you want, and return the rest'. So you consume up to (and
Paul Moore added the comment:
See https://docs.python.org/3/using/windows.html#embedded-distribution - "When
extracted, the embedded distribution is (almost) fully isolated from the user’s
system, including environment variables, system registry settings, and
installed packages."
New submission from Paul Moore:
The zipapp module allows users to bundle their application as a single file
"executable". On Windows, the file is given a ".pyz" extension which is
associated with the Python launcher. However, this approach is not always
equivalent to a na
Paul Moore added the comment:
(1) It starts an extra process (unless you're running the application from
cmd.exe) and (2) in some cases, the system won't recognise a cmd file as an
executable. For a simple example,
t.cmd:
@echo Hello from t
example.py:
from subprocess import r
Paul Moore added the comment:
I'm still unsure whether this would be a good idea. On the plus side, it
provides (in conjunction with the "embedded" distribution) a really good way of
producing a standalone application on Windows. On the minus side there are some
limitations wh
paul j3 added the comment:
The display of the Action help lines is determined by the parser.format_help
function
https://docs.python.org/3/library/argparse.html#printing-help
This function creates a Formatter, and then loads it with a 'stack' of
sections. Sections are display
paul j3 added the comment:
Yes there was/is a bug that made subparsers optional.
http://bugs.python.org/issue9253
--
nosy: +paul.j3
___
Python tracker
<http://bugs.python.org/issue28
Paul Moore added the comment:
OK, here's a first draft documentation patch. As it's purely a documentation
change, I guess it should go into the 3.5, 3.6 and trunk branches? For now it's
against trunk (it's not like that file has changed recently anyway), and I'll
Paul Moore added the comment:
is_dir is a *method*. To find out if an entry is a directory, you need to call
it.
So you need
from os import DirEntry, scandir
def test_is_dir():
for item in os.scandir(TEST_DIR):
if item.is_dir():
# ^^ note change
paul j3 added the comment:
It may help to know something about how defaults are handled - in general.
`add_argument` and `set_defaults` set the `default` attribute of the Action
(the object created by `add_argument` to hold all of its information). The
default `default` is `None`.
At the
paul j3 added the comment:
One thing that this default behavior does is allow us to append values to any
object, just so long as it has the `append` method. The default does not have
to be a standard list.
For example, in another bug/issue someone asked for an `extend` action. I
could
Paul Moore added the comment:
I can recreate this (based on the screenshots from #28366).
To reproduce, open IDLE. You get the console banner and prompt. Save that file
using File-Save. The close IDLE. Reopen it, do File-Open to open your saved
console session, then use the "Run" m
New submission from Paul G:
According to PEP495
(https://www.python.org/dev/peps/pep-0495/#aware-datetime-equality-comparison)
datetimes are considered not equal if they are an ambiguous time and have
different zones. However, currently "interzone comparison" is defined /
implemen
New submission from Paul G:
After PEP-495, the default value for non-fold-aware datetimes is that they
return the DST side, not the STD side (as was the assumption before PEP-495).
This invalidates an assumption made in `tz.fromutc()`. See lines 991-1000 of
datetime.py:
dtdst = dt.dst
Paul G added the comment:
Of the `tzinfo` implementations provided by `python-dateutil`, `tzrange`,
`tzstr` (GNU TZ strings), `tzwin` (Windows style time zones) and `tzlocal` all
satisfy this condition. These are basically all implementations of default
system time zone information.
With
Paul G added the comment:
> After all, how much effort would it save for you in dateutil if you could
> reuse the base class fromutc?
Realistically, this saves me nothing since I have to re-implement it anyway in
in all versions <= Python 3.6 (basically just the exact same algor
paul j3 added the comment:
The current error message is the result of http://bugs.python.org/issue10424
and http://bugs.python.org/issue12776
Before the test was just:
if positionals:
self.error(_('too few arguments'))
The 2nd patch reworked the test to include the revise
paul j3 added the comment:
Try `nargs='?'` or try providing a `default` along with the '*'.
Including your ARGUMENT action in the error message is intentional.
The test for this error message is:
required_actions = []
for action in self._actions:
paul j3 added the comment:
Simply including a `default` parameter, even with the default default None,
changes the error message
In [395]: parser=argparse.ArgumentParser()
In [396]: parser.add_argument('cmd');
In [397]: a=parser.add_argument('args',na
paul j3 added the comment:
My suggestion to use `metavar=('A','')` to streamline the usage creates
problems with the help code
http://bugs.python.org/issue14074
The tuple metavar does not work right for positionals. That's a old issue that
should have been fixed l
Paul G added the comment:
I've never written a "What's New" before, but here are the main things I took
away from implementing a PEP 495-compliant tzinfo class:
- The `fold` attribute is the SECOND occurrence of the time, not the first
occurrence of the time. In my first p
Paul Moore added the comment:
1. I don't think searching . should be included - on Unix /usr/bin/env searches
PATH, and I believe we should do the same here.
2. The PATH search does happen (from my reading of the code) but it looks for a
"python3" command, which isn't avai
Paul Moore added the comment:
I agree that the docs are a little confusing on this. Having said that, though,
I'm not entirely sure the behaviour needs fixing. The scenario where there's a
problem is:
1. User has written a script that needs Python 3 and won't run with Python
Jean-Paul Calderone added the comment:
My understanding of the resolution of this ticket is that it is still not
possible to use setrlimit with RLIMIT_STACK to raise the soft stack limit. Is
that correct?
In that case, the original bug report still seems valid and unresolved (and
indeed
Jean-Paul Calderone added the comment:
Not likely, given the number of things on my plate already.
_
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1598083>
_
__
New submission from Jean-Paul Calderone:
Python 2.5 deprecated raising string exceptions. It also added the
throw method to generator objects which can be used to raise an
exception, including a string exception. Raising an exception with this
method doesn't issue a deprecation warning
Changes by Paul F. Dubois:
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1165>
__
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mai
Changes by Paul F. Dubois:
--
nosy: -esr
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1165>
__
___
Python-bugs-list mailing list
Unsubs
Paul F. Dubois added the comment:
Testing auditor, this change should get this issue assigned to Collin.
--
nosy: +dubois
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/
Paul F. Dubois added the comment:
yet another test
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1002>
__
___
Python-bugs-list mailing list
Unsubs
Changes by Paul F. Dubois:
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1002>
__
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mai
Changes by Paul F. Dubois:
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1002>
__
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mai
Paul F. Dubois added the comment:
Hoping I have learned to spell, another test.
--
assignee: -> collinwinter
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.o
New submission from Paul F. Dubois:
This is a test issue, please ignore.
--
assignee: collinwinter
components: 2to3 (2.x to 3.0 conversion tool)
messages: 56123
nosy: collinwinter, dubois
severity: minor
status: open
title: Test of 2to3 component auditor
Changes by Paul F. Dubois:
--
status: open -> closed
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1198>
__
___
Python-bugs-list mailing list
Uns
New submission from Jean-Paul Calderone:
zipimporter instances have a read-only "archive" attribute, but there is
no documentation referring to it, nor any test coverage for its existence.
It's quite useful to know what a zipimporter is pointed at (for
debugging and other intros
New submission from Jean-Paul Calderone:
It's possible to construct a zipimporter with a "path" which points
first to a zip file and then continues to refer to a file within that
zip file. For example,
/foo/bar.zip/baz
where /foo/bar.zip is not a directory, but a zip fil
Changes by Jean-Paul Calderone:
--
nosy: +fijal
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1325>
__
___
Python-bugs-list mailing list
Unsubs
Changes by Jean-Paul Calderone:
--
nosy: +fijal
__
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue1326>
__
___
Python-bugs-list mailing list
Unsubs
Jean-Paul Calderone added the comment:
The APR comment is indeed correct, so this is probably a Python bug.
--
nosy: +exarkun
Tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/is
Jean-Paul Calderone added the comment:
This isn't a bug in Python. Working directory, which os.chdir modifies,
is process-global. One of your threads makes a directory, then gets
suspended while another one makes a different directory and changes into
it, then the first tries to change
Jean-Paul Calderone added the comment:
> pysetup run upload -f dist/spam-0.2.tar.gz -f dist/spam-0.2.exe
I'm not sure why it's "run upload" instead of just "upload", but maybe that's
the convention in pysetup. Apart from that, this looks like a v
New submission from Jean-Paul Calderone :
When a timezone produces an out-of-bounds utc offset, the resulting exception
always claims that the offset was 1440, rather than whatever it was. Example:
from datetime import timedelta, datetime, tzinfo
class X(tzinfo):
def utcoffset(self, time
New submission from Jean-Paul Calderone :
Consider this transcript from OS X 10.6:
>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.setlocale(locale.LC_ALL, _)
'C'
>>> locale.setlocale(locale.LC_ALL, 'en_US.UTF-8
Jean-Paul Calderone added the comment:
Since the main argument for not fixing this bug seems to be that it doesn't
affect many users, it seems like I should comment here that the issue is
affecting me. A recently proposed addition to Twisted gets bitten by this
case, resulting in a r
Jean-Paul Calderone added the comment:
Thanks for the patch Petri. Are you interested in writing a unit test for this
as well?
--
nosy: +exarkun
___
Python tracker
<http://bugs.python.org/issue11
Jean-Paul Calderone added the comment:
exar...@boson:~/Projects/python-signalfd/trunk$ PYTHONPATH=
~/Projects/python/branches/py3k/python setup.py build_ext -i
running build_ext
building 'signalfd._signalfd' extension
creating build
creating build/temp.linux-i686-3.2
creating build/
Changes by Jean-Paul Calderone :
--
resolution: -> fixed
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue9053>
___
___
Python-bugs-
Jean-Paul Calderone added the comment:
> I'll be looking at it shortly. Py3.2 is still aways from release so there is
> no hurry.
I would consider reviewing and possibly apply this change, but I don't want to
invade anyone's territory.
Changes by Jean-Paul Calderone :
--
nosy: -exarkun
___
Python tracker
<http://bugs.python.org/issue8685>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Jean-Paul Calderone :
The output of setup.py is polluted with this log message:
Importing new compiler from distutils.msvc9compiler
on Windows. For example, using pyOpenSSL's setup.py, running "setup.py
--version" produces this output:
Importing ne
New submission from Jean-Paul Calderone :
Here's a transcript which demonstrates the blocking behavior:
>>> import socket
>>> import time
>>> import ssl
>>> s = ssl.wrap_socket(socket.socket())
>>> s.connect(('localhost', 8443))
>&g
Changes by Jean-Paul Calderone :
--
title: PySSL_SSLRead loops until data is available, even in non-blocking mode
-> PySSL_SSLread loops until data is available, even in non-blocking mode
___
Python tracker
<http://bugs.python.org/iss
Jean-Paul Calderone added the comment:
Hm. I must have been testing with old versions, since I can't reproduce this
now. Sorry for the noise.
--
resolution: out of date -> duplicate
status: pending -> closed
___
Python tra
Jean-Paul Calderone added the comment:
This seems to have been caused by an ill-placed distutils.log.set_verbosity(3)
call. With that removed, this output isn't generated by default. So perhaps
this is invalid, feel free to close it as so if you
Jean-Paul Calderone added the comment:
How about nss? As a bonus, this would also avoid making more work for Fedora
(<http://fedoraproject.org/wiki/FedoraCryptoConsolidation>).
--
___
Python tracker
<http://bugs.python.org/
Jean-Paul Calderone added the comment:
What it will bring: APIs which aren't absolutely insane; full SSL support; RSA,
DSA, ECDSA, Diffie-Hellman, EC Diffie-Hellman, AES, Triple DES, DES, RC2, RC4,
SHA-1, SHA-256, SHA-384, SHA-512, MD2, MD5, HMAC: Common cryptographic
algorithms us
Jean-Paul Calderone added the comment:
> I should note that I can't touch anything to do with Elliptic Curve crypto.
> I don't know if I can comment on the reasons for that.
Hopefully anything ECC related can be done separately. There's certainly no
ECC APIs in Pytho
Jean-Paul Calderone added the comment:
> Unfortunately, select doesn't necessarily update the timeout variable with
> the remaining time, so we can't rely on this. This would mean having the
> select enclosed within gettimeofday and friends, which seems a bit overkill...
Jean-Paul Calderone added the comment:
You can't rely on id() to return distinct values across different processes.
It guarantees uniqueness *within a single process* (at any particular moment).
In other words, you're misusing id() here. This is not a Python bug.
--
nosy
Jean-Paul Calderone added the comment:
You mistakenly used "is" for these comparisons, rather than "==". The strftime
involvement is a red herring. The real problem is the use of an /identity/
comparison rather than an /equality/ comparison.
--
nosy:
Jean-Paul Calderone added the comment:
It could, but why introduce this redundancy with `os.name`?
--
nosy: +exarkun
___
Python tracker
<http://bugs.python.org/issue9
Jean-Paul Calderone added the comment:
fwiw http://mail.python.org/pipermail/python-list/2010-September/1256545.html
--
nosy: +exarkun
___
Python tracker
<http://bugs.python.org/issue9
Jean-Paul Calderone added the comment:
If the warnings are emitted as usual with the warnings module, you can use -W
to control this. -X isn't necessary.
--
nosy: +exarkun
___
Python tracker
<http://bugs.python.org/is
New submission from Jean-Paul Calderone :
>>> s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
>>> s.bind(('', 0))
>>> s.sendto(u'hellé', s.getsockname())
Traceback (most recent call last):
File "", line 1, in
TypeError: se
New submission from Jean-Paul Calderone :
Consider this transcript:
>>> cProfile.run("import time; time.sleep(1)")
4 function calls in 1.012 CPU seconds
Ordered by: standard name
ncalls tottime percall cumtime percall filename:lineno(function)
Jean-Paul Calderone added the comment:
Trial lets test cases get garbaged collected. When we noticed this wasn't
happening, we treated it as a bug and fixed it. No one ever complained about
the change. I don't see any obvious way in which an application would even be
able t
Jean-Paul Calderone added the comment:
> I thought unittest was just handed a bunch of TestCase instances and couldn't
> do much about insuring they were garbage collected.
True. But unittest could ensure that it doesn't keep a reference to each
TestCase instance after it
Jean-Paul Calderone added the comment:
Here's Trial's implementation:
http://twistedmatrix.com/trac/browser/trunk/twisted/trial/runner.py#L138
--
___
Python tracker
<http://bugs.python.o
New submission from Jean-Paul Calderone :
http://docs.python.org/py3k/howto/sockets.html#non-blocking-sockets
"And if you put a socket in more than one input list, it will only be (at most)
in one output list."
>>> import socket
>>> s = socket.socket()
&g
New submission from Jean-Paul Calderone :
This is somewhat unfortunate behavior:
>>> from xml.etree.ElementTree import QName
>>> QName('foo')
>>>
It becomes even more apparent when encountered in a situation like this:
>>> print {QName('foo
Jean-Paul Calderone added the comment:
> Phillip, your argument about interfacing with code written in C doesn't work
> for built-in immutable types like str.
Sure it does. Definitely-str is easier to handle in C than maybe-str-subclass.
It doesn't matter that str.__n
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
The heapq documentation isn't very clear about its requirements. It
does explicitly say that "Heaps are arrays for which heap[k] <=
heap[2*k+1] and heap[k] <= heap[2*k+2] for all k, counting elements from
zero
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
I tried this too and then wrote a couple unit tests for this. The one
for the Python implementation which tests the case where only __le__ is
defined fails, though.
Diff attached.
--
keywords: +patch
Added file
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
Thanks for the explanation. Unfortunately, even if we change our code
to work with the new requirements, all the old code is still out there.
Maybe this doesn't matter, since there are so many other
incompatibilities between
New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>:
Python 2.6b1+ (trunk:64531M, Jun 26 2008, 10:40:14)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> impor
New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>:
ctypes.util assumes several things of its environment which sometimes
don't hold:
* It depends on objdump being in $PATH. If it isn't, it will fail to
read the SONAME from a library, even if it has determined the pa
New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>:
If a method is inherited by two different classes, then the unbound
method objects which can be retrieved from those classes compare equal
to each other. For example:
Python 2.6b2+ (trunk:65502M, Aug 4 2008, 15:05:07)
[GCC
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
The reason I noticed this is that since they compare and hash equal, if
you put two such methods into a set, you end up with a set with one
method. Currently, this is preventing me from running two test methods
because the method
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
> But you acknowledge they are really the same method attached to
> different classes, right? The notion of "unbound method" is mostly an
> implementation detail. The term occurs only 4 times in the who
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
Any chance of getting this fixed?
___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.pytho
New submission from Paul "TBBle" Hampson <[EMAIL PROTECTED]>:
Basically, if DISTUTILS_USE_SDK is set in the environment and an
extension is attempted to be built from within the Windows SDK shell
(ie. MSSdk is set in the environment as well), msvc9compiler.py will
raise an ex
Paul "TBBle" Hampson <[EMAIL PROTECTED]> added the comment:
The line my patch adds was present originally, and lost when
msvccompiler.py was duplicated into msvc9compiler.py in revision 59290.
http://svn.python.org/view?rev=59290&view=rev
__
New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>:
In Python 2.5 and earlier, the `warnings.warn_explicit` function could
be replaced in order to test what warnings were emitted by some code.
This allowed unit tests for warnings to be written. Since much of the
warnings module
New submission from Jean-Paul Calderone <[EMAIL PROTECTED]>:
This example shows the behavior:
from warnings import catch_warnings
def test():
with catch_warnings(True) as w:
assert str(w.message) == "foo", "%r != %r" % (w.message, "foo
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
I was aware of it, but I didn't realize adding an "always" filter would
make sure all warnings always got noticed. I haven't tried changing
Twisted's use of the warnings module yet, but it looks like
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
The specific exception type isn't that important to me, as long as I can
rely on it being something in particular.
___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
Exposing a list seems like a great low-level API to me. There are no
[-1]s in the Twisted codebase as a result of using this API because we
have a higher-level API built on top of it. Having this low-level API
that doesn't
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
There was a discussion on python-dev about using things from the `test`
package from code outside the `test` package:
http://mail.python.org/pipermail/python-dev/2008-August/081860.html
___
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
Both M2Crypto and pyOpenSSL expose certificate and key objects and have
seen lots of real-world use. Following their lead would be sensible.
--
nosy: +exarkun
___
Python tracker &
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
I'm just suggesting that if the ssl module *is* going to gain
certificate and key objects, looking at existing APIs and perhaps
emulating them, to the extent that they provide functionality which the
ssl module is also going
Jean-Paul Calderone <[EMAIL PROTECTED]> added the comment:
You can load a private key from a string by creating a memory BIO and
using PEM_read_bio_PrivateKey or d2i_PrivateKey_bio.
This is how pyOpenSSL implements its load_privatekey API. You can see
the code here:
2701 - 2800 of 3213 matches
Mail list logo