Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: commit review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
___
Anand Reddy Pandikunta added the comment:
mock itself fails
--
nosy: +Anand Reddy Pandikunta
title: MagicMock constructor configuration fails for magic methods - Mock
constructor configuration fails for magic methods
Added file: http://bugs.python.org/file38654/test_mock.py
Roundup Robot added the comment:
New changeset 4dfe0634d11a by Serhiy Storchaka in branch '2.7':
Issue #21560: An attempt to write a data of wrong type no longer cause
https://hg.python.org/cpython/rev/4dfe0634d11a
New changeset 6eb48b22ff5c by Serhiy Storchaka in branch '3.4':
Issue #21560: An
Serhiy Storchaka added the comment:
No, currently UnicodeTranslateError is not used in the stdlib in 3.x. But it is
documented and supported by some error handlers. I think it should be wider
used in text-to-text translations similar to proposed in issue18814.
--
assignee: -
Berker Peksag added the comment:
Here is a new patch. I didn't touched provides, requires and obsoletes fields
since they are not used much in the setuptools era.
Distribution.finalize_options() already converts string types to lists for
platforms and keywords fields. I didn't changed that
Roundup Robot added the comment:
New changeset 4dc69e5124f8 by Serhiy Storchaka in branch 'default':
Issue #23688: Added support of arbitrary bytes-like objects and avoided
https://hg.python.org/cpython/rev/4dc69e5124f8
--
nosy: +python-dev
___
Serhiy Storchaka added the comment:
Tests are taken from issue23688. Thanks for your contribution Wolfgang.
--
assignee: - serhiy.storchaka
nosy: +serhiy.storchaka
resolution: - fixed
stage: test needed - resolved
status: open - closed
___
Python
STINNER Victor added the comment:
Hmmm... dear sir - what prevents you from adding an __all__ to the module
with these cache variables excluded ?
You didn't understand the general philosophy, we are not hidding internals. For
the specific case of platform._uname_cache, it uses the _ prefix
Anand B Pillai added the comment:
Hmmm... dear sir - what prevents you from adding an __all__ to the module with
these cache variables excluded ?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23748
Serhiy Storchaka added the comment:
Restored first os.fstat() (however it now is redundant) and addressed most
other Victor's comments.
In general I prefer EAFP over BDFL, and often except AttributeError looks
better to me than getattr().
--
Added file:
Anand B Pillai added the comment:
Closing is an easy fix, bet on my word this would appear as a different bug,
thanks for your quickie fix!
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23748
STINNER Victor added the comment:
we are all consenting adults here. Why do you modify a private attribute?
I am changing the type to security as I dont think this is a behaviour issue.
I don't understand why do you consider that it is a security vulnerability?
import hack_uname
# Someone
New submission from Mohith:
Addendum to issue 18042.
I've had a use case where I wanted to allow reverse lookups (i.e.
value-to-member lookup) for my enum.Enum that was decorated via @enum.unique.
In such a case, I would add my own class method that performs the logic. E.g.
an unoptimized
Changes by Ezio Melotti ezio.melo...@gmail.com:
--
stage: - resolved
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23751
___
___
Python-bugs-list
Serhiy Storchaka added the comment:
What approach looks better, a copy or a read-only proxy?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14260
___
Serhiy Storchaka added the comment:
OK, so left it as is if nobody complains.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
___
___
Changes by Hynek Schlawack h...@ox.cx:
--
nosy: -hynek
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21859
___
___
Python-bugs-list mailing list
Wolfgang Maier added the comment:
I see now that it is just issue21560 that went into 2.7 and that's fine.
As I said: sorry for the noise
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
Serhiy Storchaka added the comment:
I think I saw that you committed this also to the 2.7 branch,
I committed only working tests and a fix from issue21560.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
Changes by Berker Peksag berker.pek...@gmail.com:
--
stage: patch review - resolved
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22560
___
___
Serhiy Storchaka added the comment:
Use DayOfWeek(today_value).
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23751
___
Mohith added the comment:
Doh! That works. And it was in the documentation too. Silly me.
Apologies for opening an issue, and thanks for showing me the way!
--
resolution: - works for me
status: open - closed
___
Python tracker
New submission from Elmer:
I am working with a large dataset of emails and loading one of them resulted in
an exception: TypeError: unorderable types: ValueTerminal() CFWSList()
I have attached the (anonymised and minimised) email source of the email that
triggered the exception.
$ python
Anand B Pillai added the comment:
Similarly for mac_ver, java_ver etc.
platform.mac_ver()
('', ('', '', ''), '')
platform.java_ver()
('', '', ('', '', ''), ('', '', ''))
Maybe it is okay if these functions are present, but can't they raise an
exception or return None instead of returning
Anand B Pillai added the comment:
On second thoughts, why have such a function if it works correctly only when
executed from source Cpython folder using source CPython executable and not
otherwise ?
Cuz if I am calling it like that I already KNOW that I am in such an
environment.
Possibly
New submission from Andreas Sommer:
Reading over the section Replacing os.system()
(https://docs.python.org/2/library/subprocess.html#replacing-os-system), one
might assume that the return value of os.system and subprocess.call are
equivalent.
status = os.system(mycmd + myarg)
#
Serhiy Storchaka added the comment:
Here is a patch that restores support on non-contiguous memoryviews.
It would be better to drop support of non-contiguous data, because it worked
only by accident. Needed support of only bytes-like memoryviews written by
BufferedWriter.
--
Added
Wolfgang Maier added the comment:
to preserve compatibility:
there is the memoryview.c_contiguous flag. Maybe we should just check it and if
it is False fall back to the old copying behavior ?
--
___
Python tracker rep...@bugs.python.org
Wolfgang Maier added the comment:
something like:
def write(self,data):
self._check_closed()
if self.mode != WRITE:
import errno
raise OSError(errno.EBADF, write() on read-only GzipFile object)
if self.fileobj is None:
raise
Stefan Krah added the comment:
In a sense, the old behavior was an artefact of silently copying the
memoryview to bytes.
It likely wasn't intentional, but tobytes() *is* used to serialize
weird arrays to their C-contiguous representation (following the
logical structure of the array rather
Stefan Krah added the comment:
I just see that non-contiguous arrays didn't work in 2.7 either,
so that was probably the original intention.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
Wolfgang Maier added the comment:
Serhiy:
I think I saw that you committed this also to the 2.7 branch, but that would
not work since memoryviews do not have the nbytes attribute (they do not seem
to have cast either). One would have to calculate the length instead from other
properties.
New submission from Giovanni Cannata:
It's not possible to wrap a socket in tls. The StreamWriter object should have
an option to start a tls negotiation using the SSLContext of the server.
This is needed for protocols the have a start_tls feature, for example the
ldap protocol.
In a non
Serhiy Storchaka added the comment:
Note that for file-like objects we have also the same issue as issue22468.
Content-Length is not determined correctly for GzipFile and like.
--
___
Python tracker rep...@bugs.python.org
Giovanni Cannata added the comment:
Thanks, I will look to the new implementation of ssl in 3.5, and try to adapt
it for my project (sldap3). I'd like to help, but I'm not skilled in
asynchronous programming so I'm not sure if I succeed.
Bye,
Giovanni
--
Wolfgang Maier added the comment:
ouch. haven't thought of this.
OTOH, just plain io with your example:
with open('xy', 'wb') as f:
f.write(y)
Traceback (most recent call last):
File pyshell#29, line 2, in module
f.write(y)
BufferError: memoryview: underlying buffer is not
STINNER Victor added the comment:
Yes, it's not supported yet. It was already requested in this issue:
https://code.google.com/p/tulip/issues/detail?id=79
asyncio got a new SSL implementation which makes possible to implement
STARTTLS. Are you interested to implement it?
--
Stefan Krah added the comment:
I think there's a behavior change: Before you could gzip non-contiguous
views directly, now that operation raises BufferError.
--
nosy: +skrah
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
Serhiy Storchaka added the comment:
Could you provide an example?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
___
___
Python-bugs-list
Stefan Krah added the comment:
Sure:
import gzip
x = memoryview(b'x' * 10)
y = x[::-1]
with gzip.GzipFile(x, 'w') as f:
f.write(y)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
Brett Cannon added the comment:
I say switch to what Argument Clinic uses, else there's a disconnect
syntactically between help() and the docs.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23738
Changes by Brett Cannon br...@python.org:
--
assignee: - brett.cannon
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21062
___
___
Petr Viktorin added the comment:
Changed the macro to Py_RETURN_RICHCOMPARE. This is not an expression, allowing
the use of a switch statement. On the other hand, it's even larger macro than
before now.
From the discussion it seems that doing this correctly is tricky to do this
correctly -
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
Added file: http://bugs.python.org/file38645/timings_deque_bool.txt
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23744
___
New submission from Raymond Hettinger:
The __bool__ method is a little faster than __len__.
Timings attached.
--
assignee: rhettinger
components: Library (Lib)
files: deque_bool1.diff
keywords: patch
messages: 238983
nosy: rhettinger
priority: normal
severity: normal
status: open
title:
Changes by Berker Peksag berker.pek...@gmail.com:
--
nosy: +berker.peksag
stage: - needs patch
versions: -Python 3.4, Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23378
___
Paul Moore added the comment:
One further thought. This is a change in behaviour (albeit to a script in
Tools), so I'm inclined to say it's a new feature for 3.5, rather than a bugfix
to be backported to 2.7 and 3.4.
For users of 2.7/3.4, the workaround is simply to rerun the script - it
STINNER Victor added the comment:
fileio_drop_dup_fstat.patch: Remove the duplicate call to fstat() in fileio.c.
Tests pass, invalid FD are still detected since there is a second call to
fstat() which also raises OSError(EBADF) if fstat(fd) fails.
--
keywords: +patch
Added file:
STINNER Victor added the comment:
My changes only *removes* code and so make it simpler ;-)
$ diffstat stat.patch
Include/fileutils.h |6 --
Include/pyport.h | 22 --
Modules/_io/fileio.c | 20
Modules/mmapmodule.c |4
Paul Moore added the comment:
There's actually a bug in the pre-3.5 script beyond the does the directory
exist check. The code is
if hasattr(site, USER_SITE):
userpath = site.USER_SITE.replace(appdata, %APPDATA%)
userscripts = os.path.join(userpath, Scripts)
which sets
Changes by Gregory P. Smith g...@krypto.org:
--
nosy: +gregory.p.smith
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23731
___
___
Steve Dower added the comment:
This script adds them to PATH. As I said, the original issue is not a bug, but
it has drawn attention to something we apparently missed a while ago.
--
___
Python tracker rep...@bugs.python.org
Paul Moore added the comment:
... because I think it does do that (see
http://bugs.python.org/file38085/userscripts.patch which updates this file)
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16328
Paul Moore added the comment:
One further thought - the installer can't create the user scripts directory if
you're doing an all-users install, that's sort of the point of all users. It
could do so for a per-user install, but then there would be an inconsistency
that I don't think is a good
Steve Dower added the comment:
Ah, you're right, it was fixed. Guess I misread my local copy (or I was looking
at 3.4).
That patch looks good to me. It'll help cover the case where someone does
something to create the directory.
--
___
Python
Paul Moore added the comment:
Pip and/or setuptools will add the Scripts directory when needed, so it's not a
big deal that the installer doesn't create it. In 2.7.9 and later, and 3.4
onwards, the Scripts directory is created as part of the ensurepip step of the
install, so it's pretty much
New submission from STINNER Victor:
While reviewing a Python implementation of io.FileIO (_pyio.FileIO) in the
issue #21859, many issues were found in the C implementation. I open an issue
to fix them.
We may fix them before or after the Python implementation is merged.
--
STINNER Victor added the comment:
I opened the issue #23752: Cleanup io.FileIO.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21859
___
___
Paul Moore added the comment:
I think the problem here is that as the OP mentioned, win_add2path.py doesn't
add the directory if it doesn't exist, so if you run it immediately after
install, it won't add the directories that don't exist yet. And because it's
setting the registry entries to
Paul Moore added the comment:
Here is a patch to fix the issue.
--
keywords: +patch
Added file: http://bugs.python.org/file38659/addpath.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16328
Roundup Robot added the comment:
New changeset d6003de8ecc8 by Victor Stinner in branch '3.4':
Issue #23654: Fix faulthandler._stack_overflow() for the Intel C Compiler (ICC)
https://hg.python.org/cpython/rev/d6003de8ecc8
--
nosy: +python-dev
___
Stefan Behnel added the comment:
Absolutely. Fractions are all about exact calculations, much more so than
Decimals. So the formatting output should be as accurate as requested or
possible (well, excluding infinity).
--
nosy: +scoder
___
Python
Paul Moore added the comment:
Cool. I'll try to set up a test (it's not covered by the testsuite AFAICT) on a
VM or something, just to confirm I haven't broken anything.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16328
STINNER Victor added the comment:
Thanks for your contribution Matt!
--
resolution: - fixed
status: open - closed
versions: -Python 3.6
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23654
Paul Moore added the comment:
Steve - is it the fact that it's not using the versioned user-site directory
that you're referring to?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16328
Serhiy Storchaka added the comment:
Here is a patch.
--
assignee: - serhiy.storchaka
components: +Library (Lib)
keywords: +patch
stage: needs patch - patch review
versions: +Python 2.7
Added file: http://bugs.python.org/file38646/issue23742.patch
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21526
___
Changes by Serhiy Storchaka storch...@gmail.com:
--
resolution: - fixed
stage: patch review - resolved
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23252
___
Arnt Gulbrandsen added the comment:
You're entirely right. I should've reread 2683 too (a decade has passed since I
read that).
The danger with accepting the unlimited line length is that batch scripts might
accept an infinitely large batch. Which is a matter of python culture, really.
(This
New submission from Anand B Pillai:
On Python 3.5.0a1+ built from source,
import sysconfig
sysconfig.is_python_build()
False
sysconfig.is_python_build(True)
False
sysconfig._PROJECT_BASE
'/opt/bin'
import sys
sys._home
The problem is, when sys._home is None, this function uses
STINNER Victor added the comment:
Why is this function even exposed on Linux?
It is a deliberate design choice of the platform module. mac_ver(), win32_ver()
and linux_distribution() are available on all platforms.
mac_ver() says entries which cannot be determined are set to ''. All tuple
STINNER Victor added the comment:
On second thoughts, why have such a function if it works correctly only when
executed from source Cpython folder using source CPython executable and not
otherwise ?
It's useful to know such information. Python behaves a little bit
differently when run
Anand B Pillai added the comment:
Lib/test/test_asdl_parser.py:12:if not sysconfig.is_python_build():
As I guessed - it is used internally by unit tests and possibly has no other
significan audience.
It is best to document this clearly.
--
___
Serhiy Storchaka added the comment:
I should agree with you. Then the patch LGTM.
--
assignee: - berker.peksag
stage: patch review - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23062
Serhiy Storchaka added the comment:
Addressed Berker's comments. Added versionchanged directives and a whatsnews
entry.
--
Added file: http://bugs.python.org/file38648/distutils-lzma_3.patch
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
Maybe it is okay if these functions are present, but can't they raise an
exception or return None instead of returning these funny tuples when empty
strings ?
It would break the backward compatibility. Again, it's a delibarate choice.
--
Serhiy Storchaka added the comment:
LGTM.
--
stage: patch review - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22977
___
___
Serhiy Storchaka added the comment:
In general the patch LGTM.
--
assignee: - serhiy.storchaka
stage: - commit review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
___
Anand B Pillai added the comment:
I am changing the type to security as I dont think this is a behaviour issue.
--
type: behavior - security
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23748
Serhiy Storchaka added the comment:
There are other occurrences of %X in the code. Do you want provide a patch for
them Martin?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22977
___
Changes by Anand B Pillai abpil...@gmail.com:
Added file: http://bugs.python.org/file38649/sysconfig_test.py
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23746
___
Nick Coghlan added the comment:
I think we learned our lesson re making decisions at the language summit
(rather than focusing on bringing folks up to speed on a problem area) after
needing to later reverse engineer the rationale for some of the decisions made
at the first couple :)
Martin Teichmann added the comment:
A note on the implementation:
The compiler leaves a __cell__ entry in the class' namespace, which
is then filled by type.__new__, and removed from the namespace by
the latter. This is the same way it is done for __qualname__.
As the patch tampers with the
New submission from Anand B Pillai:
import platform
print 'Actual =',platform.uname()
Actual = ('Linux', 'toshiba-laptop', '3.13.0-24-generic', '#47-Ubuntu SMP Fri
May 2 23:30:00 UTC 2014', 'x86_64', 'x86_64')
import hack_uname
# Someone imports my module unaware of the hack (see attached
Serhiy Storchaka added the comment:
Updated to the tip (added the closefd attribute in repr). os.fstat() is now
called only once in the constructor.
--
Added file: http://bugs.python.org/file38651/pyio_fileio_7.patch
___
Python tracker
Changes by Wolfgang Maier wolfgang.ma...@biologie.uni-freiburg.de:
Added file: http://bugs.python.org/file38650/write_bytes_like_objects_v3.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23688
STINNER Victor added the comment:
IMO it's more a documentation issue than a bug.
sysconfig.is_python_build() returns True when Python is run from its source
code directory. For example, I compiled Python in ~/prog/python/default.
~/prog/python/default/python returns True.
I installed python
New submission from Anand B Pillai:
import platform
platform.system()
'Linux'
platform.win32_ver()
('', '', '', '')
Why is this function even exposed on Linux ? It should be conditionally exposed
only on win32 platforms.
Funny that this is coming from the module named platform itself :)
Anand B Pillai added the comment:
Thanks. From current documentation it isn't clear. Agree to make this a doc bug
then.
It should also be made clear this would work only for the executable built in
the source directory. As in,
(Running from the source folder using source Python executable).
Michael Foord added the comment:
I like the first variant suggested by Ezio as more concise. I'll try and look
at the substance of the patch today.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15836
STINNER Victor added the comment:
See also issue #21861: io class name are hardcoded in reprs.
In my review of _pyio.FileIO, I asked if it would be possible to use
__qualname__ in __getstate__().
--
___
Python tracker rep...@bugs.python.org
STINNER Victor added the comment:
New issue #23754: Add a new os.read_into() function to avoid memory copies.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21859
___
STINNER Victor added the comment:
stat.patch: Stop pretending that Python works without stat() nor fstat(),
consider that these functions are always available.
--
keywords: +patch
Added file: http://bugs.python.org/file38660/stat.patch
___
Python
Serhiy Storchaka added the comment:
See issue22623 for moving in opposite direction.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23753
___
STINNER Victor added the comment:
The previous change related to fstat() is the changeset 3b5279b5bfd1 from the
issue #21679. The changeset introduces the private _blksize attribute. The
strange thing is that the changelog is:
Issue #21679: Prevent extraneous fstat() calls during open().
STINNER Victor added the comment:
Many POSIX functions aren’t available on every system, especially embedded
ones.
What do you call embedded systems? I worked on set top boxes (the box to
watch television) between 2011 and 2013 and we had a regular Linux kernel with
all POSIX functions.
Charles-François Natali added the comment:
+1 from me, fstat() has always been par of POSIX.
It's really likely Python won't build anyway on such systems.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23753
STINNER Victor added the comment:
fstat_not_eintr.py: run this script from a NFS share and unplug the network
cable, wait, replug. Spoiler: fstat() hangs until the network is back, CTRL+c
or setitimer() don't interrupt it.
By the way, it looks like the itimer is interrupted during fstat!
STINNER Victor added the comment:
Well, all the syscalls which can blocki can fail with EINTR, so all
I:O related one.
This is also what I expect, but how do you explain that I'm unable to see
os.stat() failing with EINTR? I'm testing on ext4 file system. May it occur
with other file
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23753
___
___
1 - 100 of 128 matches
Mail list logo