Changes by Emanuel Barry :
--
nosy: +haypo, serhiy.storchaka
stage: -> needs patch
type: -> behavior
___
Python tracker
<http://bugs.python.org/i
Emanuel Barry added the comment:
Unfortunately not. I no longer have the time or means to work on this, sorry. I
hope someone else can pick it up.
--
___
Python tracker
<https://bugs.python.org/issue28
Change by Emanuel Barry :
--
nosy: -ebarry
___
Python tracker
<https://bugs.python.org/issue28937>
___
___
Python-bugs-list mailing list
Unsubscribe:
New submission from Emanuel Barry :
This is a follow-up to Issue27364.
Back in Python 3.6, a silent warning was added for all invalid escape sequences
in str and bytes. It was suggested that it would remain a silent warning (which
still impacts tests, while not visually annoying the average
Emanuel Barry added the comment:
I have created Issue32912 as a follow-up to this issue for 3.8.
--
___
Python tracker
<https://bugs.python.org/issue27
Change by Emanuel Barry :
--
keywords: +patch
pull_requests: +5625
stage: needs patch -> patch review
___
Python tracker
<https://bugs.python.org/issu
Emanuel Barry added the comment:
The documentation is correct. The first argument in both of those cases is a
str, which may not be what you were expecting, but the calls are still valid.
--
nosy: +ebarry
resolution: -> not a bug
stage: -> resolved
status: open -&g
Emanuel Barry added the comment:
This is because `exec` is a keyword in Python 2, whereas in Python 3 it's a
function.
--
nosy: +ebarry
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python t
Emanuel Barry added the comment:
Any valid variable name can be used as a an attribute; for example, "spam" is
valid while "spam-eggs" is not. This isn't unique to classes, but to all
assignments everywhere. If we allowed `o.exec = blah` then we should also allow
`e
Emanuel Barry added the comment:
`type` has a default `__format__` implementation which doesn't accept any
formatting options. This is expected behaviour.
--
nosy: +ebarry
resolution: -> not a bug
stage: -> resolved
status: ope
Change by Emanuel Barry :
--
Removed message: https://bugs.python.org/msg316153
___
Python tracker
<https://bugs.python.org/issue33423>
___
___
Python-bugs-list m
Emanuel Barry added the comment:
You don't have access to this feature, so I've deleted the message for you :)
--
nosy: +ebarry
___
Python tracker
<https://bugs.python.o
Emanuel Barry added the comment:
This is a known issue, and is properly explained here:
https://docs.python.org/3/faq/programming.html#why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works
--
nosy: +ebarry
resolution: -> not a bug
stage: -> resolved
status
Emanuel Barry added the comment:
Nice initiative! I like the idea of moving towards more inclusive
documentation; as an addition, I would recommend using they/them/their instead
- it's less clumsy to read (also, singular they is perfectly valid English) and
includes everyone, even thos
Emanuel Barry added the comment:
Ow!
I can confirm the bug still happens on latest trunk. Nice finding!
--
nosy: +ebarry, ned.deily, rhettinger, serhiy.storchaka
priority: normal -> release blocker
stage: -> needs patch
___
Python tracker
Changes by Emanuel Barry :
--
nosy: +Martin.Teichmann
___
Python tracker
<http://bugs.python.org/issue28797>
___
___
Python-bugs-list mailing list
Unsubscribe:
Emanuel Barry added the comment:
Decorater: For very large projects, the switch from Python 2 to 3 is a
non-trivial task that can take up years of work, and there are many reasons why
one cannot switch.
On the issue, however, for all PyPi-related issues, please go to the PyPa
GitHub: https
Emanuel Barry added the comment:
Let's just close this.
--
nosy: +ebarry
resolution: -> rejected
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.pyth
Changes by Emanuel Barry :
--
nosy: +ebarry
___
Python tracker
<http://bugs.python.org/issue23722>
___
___
Python-bugs-list mailing list
Unsubscribe:
Emanuel Barry added the comment:
Additionally, trying to access an attribute before assigning it will result in
an AttributeError on all subsequent accesses (even if set).
I didn't manage to get a segfault, however.
--
nosy: +ebarry
___
P
Emanuel Barry added the comment:
Part of the copyright notice, as SilentGhost mentioned. This can't be removed.
--
nosy: +ebarry
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<http:
Emanuel Barry added the comment:
As a matter of fact, A.__module__ in this case is abc.ABCMeta.__module__. A
class body creates a __module__ key, while a direct metaclass call does not.
--
nosy: +ebarry
___
Python tracker
<http://bugs.python.
Emanuel Barry added the comment:
Oh, nicely spotted! Apparently I was wrong, and it does create a key;
defaulting to __name__.
About the original issue, I don't think it's easily possible to fix, sadly.
--
___
Python trac
Emanuel Barry added the comment:
I understand the feeling. However, in a project I maintain, we want the other
way around - to be able to never have an empty list, even if the string is
empty (we resorted to using re.split in the end, which has this behaviour).
Consider:
rest = re.split
Emanuel Barry added the comment:
Changing the behaviour when sep is None is a big backwards-compatibility break,
and I'm not sure we'd even want that. It's logical to allow passing None to
mean the same thing as NULL (i.e. no arguments), and the behaviour in that case
has bee
Emanuel Barry added the comment:
That would work for my case, but it wouldn't for Barry's (unless I missed
something). He wants a non-None argument to not leave empty strings, but I want
a None argument to leave empty strings... I don't think there's a
one-size-fits-all s
Emanuel Barry added the comment:
Actually, there might be a way. We could make prune default to True if sep is
None, and default to False if sep is not None. That way, we get to keep the
existing behaviour for either case, while satisfying both of our use cases :)
If that's a bad idea (a
Emanuel Barry added the comment:
Matthew: Yes, that's exactly the way I was going about it.
Thank you Raymond for your comments (and your informative answer on that SO
question).
I think that part of the problem is that no delimiter (or None) behaves
differently than with a delimiter.
Emanuel Barry added the comment:
Here's an initial patch. It works exactly as discussed earlier, doesn't break
any tests, and retains full backwards compatibility. No doc changes (except for
the docstrings of str.[r]split) and no tests, as this is just a preliminary
patch to see
Emanuel Barry added the comment:
Yes, I agree that being able to pass in a tuple would be really useful. As far
as rolling out a custom function goes, I'd sooner reach for re.split than do
that, so I don't really have a strong argument for either side. Feel free to
play with the pat
Changes by Emanuel Barry :
Removed file: http://bugs.python.org/file45853/split_prune_1.patch
___
Python tracker
<http://bugs.python.org/issue28937>
___
___
Python-bug
Emanuel Barry added the comment:
Barry: Sure, the docs example was just a quick write-up, you can word it
however you want!
Guido: Pretty much, except the other way around (when prune is False, i.e.
"don't remove empty strings").
The attached patch exposes the behaviour (it
Emanuel Barry added the comment:
That indeed looks like a bug. Well spotted :)
That code has been there since unittest.mock was added back in March 2012. If I
were to guess, I'd say that it should be `if name is None: name = ''`. Care to
submit a patch?
-
Changes by Emanuel Barry :
--
stage: needs patch -> commit review
___
Python tracker
<http://bugs.python.org/issue28961>
___
___
Python-bugs-list mai
Emanuel Barry added the comment:
LGTM. Thanks for the patch!
--
nosy: +ebarry
stage: -> commit review
___
Python tracker
<http://bugs.python.org/issu
Emanuel Barry added the comment:
The reason why Python behaves like that in this case is a side-effect of the
way the data model is implemented. Lists are a mutable data type, which means
that referencing the same list - which is what you are doing - as opposed to
creating a new one each time
New submission from Emanuel Barry:
functools.partial is a class in C, but the Python implementation is a function.
This doesn't matter for most use cases where you only want the end result of
the call to partial.
A simple line in the REPL tells me enough (or so I thought) that I wou
Emanuel Barry added the comment:
You do raise a valid point, sequence repetition (*) on lists of mutable objects
serves very little purpose. However, as I stated, it is a side-effect of the
data model and changing it would be yet another special case, which aren't
special enough to brea
Emanuel Barry added the comment:
Attached patch turns the Python implementation of functools.partial into a
class. The implementation is as close to the C version as possible, except
__repr__ where I went for a different, more Pythonic approach (output is
identical).
I haven't yet
Emanuel Barry added the comment:
Serhiy, it seems as though _functools is always required for functools to work
- heck, tests start to fail all over the place if it isn't available, because
functools.reduce doesn't exist.
Subclassing _functools.partial is already tested for, so
Emanuel Barry added the comment:
Functionally, both versions are equivalent, but one is a class and the other is
not. From PEP 399:
"Technical details of the VM providing the accelerated code are allowed to
differ as necessary, e.g., a class being a `type` when implemented in C."
Changes by Emanuel Barry :
--
Removed message: http://bugs.python.org/msg266608
___
Python tracker
<http://bugs.python.org/issue27129>
___
___
Python-bugs-list m
Changes by Emanuel Barry :
--
Removed message: http://bugs.python.org/msg266607
___
Python tracker
<http://bugs.python.org/issue27129>
___
___
Python-bugs-list m
Emanuel Barry added the comment:
A negative return code generally means an error occurred. Negating retcode here
is equivalent to abs(retcode), which shows you want a positive integer to
appear in the message - it's not an error.
Could replace '-retcode' with 'abs(retcod
Emanuel Barry added the comment:
Works for me:
>>> class X(type): pass
...
>>> X(X)
--
nosy: +ebarry
resolution: -> works for me
stage: -> resolved
status: open -> closed
___
Python tracker
<htt
Emanuel Barry added the comment:
Works for me:
>>> class meta(type): pass
...
>>> class X(type, metaclass=meta): pass
...
>>> X.__class__ = X
>>> type(X) is X
True
>>> isinstance(X, X)
True
--
nosy: +ebarry
resolution: -> works f
Emanuel Barry added the comment:
This seems as though you might be using an older version of the interpreter (I
tested in 3.4.3, 3.5.1 and 3.6.0a1+). Where did you get your interpreter? The
official releases are on https://www.python.org/downloads/ - if you got it
somewhere else, that might
Emanuel Barry added the comment:
In Objects/typeobject.c#L2290, the code checks that the (meta?)class is exactly
`type` and that there's one argument, then returns `Py_TYPE(x)`. Subclasses of
`type` allowing a single argument is a side-effect of not overriding __new__,
not a docum
Emanuel Barry added the comment:
Yes, that would be preferable. The error message is at
Objects/typeobject.c#l2301, but keep in mind that this message is shown for
both faulty calls to type() as well as any of its subclasses that don't
override __new__, and I'm lukewarm on add
Emanuel Barry added the comment:
+1. I prefer that change, as using subclasses of `type` as if they were type
itself never made sense to me. This shouldn't break existing code, but if it
does, it was either a concealed bug or a very bad idea to begin with, and
should be fixed eithe
Changes by Emanuel Barry :
--
stage: needs patch -> patch review
___
Python tracker
<http://bugs.python.org/issue27157>
___
___
Python-bugs-list mailing list
Un
Emanuel Barry added the comment:
Yes, `metatype == &PyType_Type` makes sure that only `type` itself is valid for
the one-argument part, whereas subclasses can also do so right now. I clarified
that in a comment in the new patch, so that someone doesn't accidentally revert
this,
Changes by Emanuel Barry :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue27160>
___
___
Emanuel Barry added the comment:
In other words, you cannot use keys containing a colon in str.format - you'll
need to replace the colons by something else (for example an underscore, that
works fine).
--
nosy: +ebarry
___
Python tracker
Emanuel Barry added the comment:
New patch after Serhiy's comments. I kept the __dict__ in pickling to properly
pickle attributes that aren't defined by 'partial' itself; but if 'func',
'args' or 'keywords' are present and don't match
Emanuel Barry added the comment:
Fair enough. Should this get a note in What's new? Possibly in the "Changes in
Python API" section.
--
stage: patch review -> commit review
versions: +Python 3.6 -Python 2.7, Python 3.4
___
Pyt
Emanuel Barry added the comment:
The behaviour is correct, it's your assumptions that aren't :)
The code for str.format only checks for what's before the colon (here, "HGNC")
and checks if that's part of the dict provided. It isn't, so it raises a
KeyError
Emanuel Barry added the comment:
Let me just make sure I got you right - you're fine with `type` and only `type`
being able to use the one-argument form in 3.6, but prefer 3.5 and 2.7 to be
even more permissive than they currently are? Regardless, I don't think this
should go int
Changes by Emanuel Barry :
--
Removed message: http://bugs.python.org/msg266711
___
Python tracker
<http://bugs.python.org/issue27157>
___
___
Python-bugs-list m
Emanuel Barry added the comment:
New patch with tests and documentation. I didn't really know where to put the
tests; test_types seemed reasonable to me (other option was test_metaclass).
--
stage: test needed -> commit review
___
Python
Changes by Emanuel Barry :
Added file: http://bugs.python.org/file43060/type_one_argument_3.patch
___
Python tracker
<http://bugs.python.org/issue27157>
___
___
Python-bug
Emanuel Barry added the comment:
New patch with Berker's comments. I'm really not used to Sphinx markup so
thanks for that!
> Is there any person who really thinks that their own patch is *not* ready for
> commit review? :)
Partial patches aren't that uncommon in
Changes by Emanuel Barry :
--
Removed message: http://bugs.python.org/msg266751
___
Python tracker
<http://bugs.python.org/issue27166>
___
___
Python-bugs-list m
Changes by Emanuel Barry :
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
Python tracker
<http://bugs.python.org/issue27166>
___
___
Changes by Emanuel Barry :
--
resolution: -> fixed
stage: patch review -> resolved
___
Python tracker
<http://bugs.python.org/issue21271>
___
___
Pyth
Changes by Emanuel Barry :
--
resolution: -> duplicate
stage: -> resolved
status: open -> closed
superseder: -> Tkinter Unresponsive With Special Keys
___
Python tracker
<http://bugs.python
Changes by Emanuel Barry :
--
components: +Extension Modules
stage: -> needs patch
type: -> behavior
___
Python tracker
<http://bugs.python.org/i
Emanuel Barry added the comment:
I'd probably change all instances of ".*" in the regex matches to be "0x.+"
instead. For the docstrings that have "..." in them, I would probably make
those " at ..." as well (although you get decide if it hinders r
Changes by Emanuel Barry :
--
components: +IDLE, Macintosh
nosy: +kbk, ned.deily, roger.serwy, ronaldoussoren, terry.reedy
stage: -> test needed
type: resource usage -> behavior
versions: +Python 3.5
___
Python tracker
<http://bugs.p
New submission from Emanuel Barry:
Attached patch adds a pure Python version of `collections.defaultdict`. This is
yet another step in providing better support for alternate implementations,
which may or may not have `_collections`.
I also went ahead and fixed __all__ so that `from
Changes by Emanuel Barry :
--
title: `string` exposes ChainMap from `collections` -> Add __all__ list to the
string module
___
Python tracker
<http://bugs.python.org/issu
Emanuel Barry added the comment:
Git diffs work, but this one doesn't apply cleanly. I manually fixed it and
re-generated the patch. Rietveld should pick it up now.
Otherwise, what Jelle said. I'm not sure if the macro has the best name though
- I'd probably name it `PyPartial_
Emanuel Barry added the comment:
New patch with Jelle's suggestions. I completely removed the macros since we
need to (potentially) call Python code with PyObject_IsInstance, and need to
check for return code.
I also reverted some of the unrelated changes.
--
Added file:
Emanuel Barry added the comment:
New patch, now almost all the tests that are used for the C version are also
used for the Python version (the only exception is the one checking that trying
to change/delete attributes would raise an error). Some tests needed a bit of
tweaking to work with the
Emanuel Barry added the comment:
Shakur - Feel free to take over and work on it.
Serhiy - I don't think that partial(func) == func should be, in the same sense
that (0, 1, 2), [0, 1, 2] and range(3) aren't equal even though they
fundamentally represent the
New submission from Emanuel Barry:
The NotImplemented docs aren't explicit enough when it comes to where it
can/should be used. Patch attached.
--
assignee: docs@python
components: Documentation
files: NotImplemented_wording_1.patch
keywords: patch
messages: 267543
nosy: docs@p
Emanuel Barry added the comment:
Added further notes to `NotImplemented` and `NotImplementedError` to clearly
state the differences between the two. I also added some more details to
`TypeError` - I'm amazed at how little was described for such a common
exception!
Maybe I explained a bi
Emanuel Barry added the comment:
Your report was already addressed in #27192, and the solution to your problem
was given by Ned Deily. If you are still experiencing crashes with the official
python.org version, please specify so. In the meantime, I'm closing this off as
dupl
Emanuel Barry added the comment:
New patch with small tweaks. Thanks Jelle for the comments!
--
Added file:
http://bugs.python.org/file43273/NotImplemented_exceptions_wording_3.patch
___
Python tracker
<http://bugs.python.org/issue27
Emanuel Barry added the comment:
More tweaks after Ethan's comments. This is starting to get way outside of the
realm of NotImplemented, but it still makes for a good reference to point
confused users at.
--
Added file:
http://bugs.python.org/file
Emanuel Barry added the comment:
Martin: yes, I plan to install Sphinx soon enough, so that I can build the docs.
As for the notes part, I indented it exactly like it was indented for other
existing notes boxes in the same file. I'll change that if needed t
Emanuel Barry added the comment:
(Berker beat me to it, but posting anyway since it is more detailed)
Backslashes are escape characters, and "\b" is treated as "\x08". Invalid
combinations (e.g. "\A", "\D"...) automatically escape the backslash, but yo
Emanuel Barry added the comment:
`dict` subclasses can be hashable - it's a very bad idea, but not guarded
against. If you were to do this, I'd suggest going the exception way, à la
StopIteration.
I wonder how feasible it would be for e.g. dict.__setitem__ to check if a key
alre
Emanuel Barry added the comment:
I'm not too familiar with the json package, but what should __json__ return
when called?
--
nosy: +ebarry
stage: -> test needed
versions: +Python 3.6
___
Python tracker
<http://bugs.python.org
Emanuel Barry added the comment:
So __json__ returns a string meant to be serializable. I'm not too keen on
using a dunder name (although my word doesn't weigh anything ;) and I'd
personally prefer something like as_json_string(). I think the idea in general
is good, though. Mi
New submission from Emanuel Barry:
Attached patch deprecates invalid escape sequences in unicode strings. The
point of this is to prevent issues such as #27356 (and possibly other similar
ones) in the future.
Without the patch:
>>> "hello \world"
'hello \\world'
Emanuel Barry added the comment:
Now I have! I found nothing on Python-Dev, but apparently it's been discussed
on Python-ideas before:
https://mail.python.org/pipermail/python-ideas/2015-August/035031.html Guido
hasn't participated in that discussion, and most of it was "
Emanuel Barry added the comment:
Yes, it's in use in an awful lot of places (see my patch). The proper fix is to
use raw strings, or, if you need actual escapes in the same string, manually
escape them. However, as you'll see by looking at the patch, the vast majority
of cases ar
Emanuel Barry added the comment:
Thanks, didn't find that one. Apparently Guido's stance is "Make this a silent
warning, then we can discuss about preventing it later", which happens to be
what I'm doing here.
--
Emanuel Barry added the comment:
I found the cause of the failed assertion, an invalid escape sequence slipped
through in a file. Patch attached (also with Serhiy's comments).
It worries me a little though that pure Python code can cause a hard crash. Ok,
it worries me a lot. Please
Emanuel Barry added the comment:
You're overriding the 'calendar' variable, holding the module, by the result of
your 'calender.month' call, which happens to be a str. Use a different variable
name (e.g. 'result') and the error will disappear.
Unrelated
Emanuel Barry added the comment:
I originally considered making two different patches, so there you go.
deprecate_invalid_escapes_only_1.patch has the deprecation plus a test, and
invalid_stdlib_escapes_1.patch fixes all invalid escapes in the stdlib.
My code was the cause, although no
Changes by Emanuel Barry :
Added file: http://bugs.python.org/file43550/invalid_stdlib_escapes_1.patch
___
Python tracker
<http://bugs.python.org/issue27364>
___
___
Pytho
New submission from Emanuel Barry:
My trivial patch exposed a bug in the ast/compiler, where compile() would
return a value and set an exception. See
http://bugs.python.org/issue27364#msg269323 for more information and steps to
reproduce. I looked a bit into it, but I don't know enough
Emanuel Barry added the comment:
Ah right, assert() is only enabled in debug mode, I forgot that. My (very
uneducated) guess is that compile() got the error (which was a warning) but
then decided to return a value anyway, and the next thing that tries to call
anything crashes Python. I opened
Emanuel Barry added the comment:
Nevermind, my mistake.
--
resolution: -> not a bug
stage: needs patch -> resolved
status: open -> closed
type: crash ->
___
Python tracker
<http://bugs.python
Emanuel Barry added the comment:
Aaand I feel pretty stupid; I didn't check the return value of
PyErr_WarnFormat, so it was my mistake. Attached new patch, actually done right
this time.
--
Added file:
http://bugs.python.org/file43552/deprecate_invalid_escapes_only_2.
Emanuel Barry added the comment:
Indeed, we did, thanks for letting me know my mistake :) I didn't get very far
into making bytes literal disallow invalid sequences, as I ran into issues with
_codecs.escape_decode throwing the warning even when the literal was fine, and
I think I st
Emanuel Barry added the comment:
I think ultimately a SyntaxError should be fine. I don't know *when* it becomes
appropriate to change a warning into an error; I was thinking 3.7 but, as
Serhiy said, there's no rush. I think waiting five release cycles is overkill
though, that means
Emanuel Barry added the comment:
Easing transition is always a good idea. I'll contact the PyCQA people later
today when I'm back home.
On afterthought, it makes sense to wait more than two release cycles before
making this an error. I don't really have a strong opinion wh
1 - 100 of 358 matches
Mail list logo