[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Rebecka

Rebecka added the comment:

Akira is correct: using time.mktime to produce the expiration date for the 
cookie is wrong (thank you very much for the pointers!).

Using e.g. http.cookiejar.http2time with a HTTP formatted date string gives a 
correct time stamp (with which cookie.is_expired succeeds), so this was not a 
bug (just user error...).

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22038] Implement atomic operations on non-x86 platforms

2014-09-01 Thread John Malmberg

Changes by John Malmberg :


--
nosy: +John.Malmberg

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22323] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Attached patch implements this.

There is no patch.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22166] test_codecs leaks references

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> We should maybe enhance the codecs API to be able to unregister a codec?

That would be nice. At least as a private API in 3.4.

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1508475] transparent gzip compression in urllib

2014-09-01 Thread Martin Panter

Martin Panter added the comment:

I think the patch is indeed a bit short, for instannce it looks like calling 
read() without a size limit could bypass the decoding.

Also, I wonder if Content-Encoding handling is better done at a higher level. 
What if someone wants to download a *.tar.gz file? They may not expect the tar 
file to be transparently decompressed. And I suspect this would blow up if you 
tried a partial range request.

Transfer-Encoding is meant to be the proper way to transparently compress HTTP 
messages at a low level, but it doesn’t seem to be used as much in the real 
world.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19826] Document that bug reporting by email is possible

2014-09-01 Thread R. David Murray

R. David Murray added the comment:

I'd be just as happy to not document this.  The fact that you need an account 
first means that people will try to submit without an account, and get a 
bounce.  It also works better when people reply on the bug tracker rather than 
by email.  I'd not want to take the capability away, but I'd prefer to not 
document or encourage it.  That, however, is just my opinion.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19826] Document that bug reporting by email is possible

2014-09-01 Thread Mike Short

Mike Short added the comment:

Same addition to the Python Dev Guide - seemed more appropriate on the tracker 
page vs. the triaging page.

--
Added file: http://bugs.python.org/file36526/tracker.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19826] Document that bug reporting by email is possible

2014-09-01 Thread Mike Short

Mike Short added the comment:

Addition to bugs.html to describe submitting bugs via email

--
keywords: +patch
nosy: +Mike.Short
Added file: http://bugs.python.org/file36525/bugs.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22166] test_codecs leaks references

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

ExceptionChainingTest creates a random codec name. If you change the codec name 
to a fixed string like "xxx", ExceptionChainingTest.test_raise_by_type() 
doesn't leak anymore (when  test_codecs_fix1.patch is applied), but other tests 
start to fail.

We should maybe enhance the codecs API to be able to unregister a codec?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22166] test_codecs leaks references

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

Attached: Draft patch to fix some reference leaks in test_codecs.

--
title: test_codecs "leaking" references -> test_codecs leaks references
Added file: http://bugs.python.org/file36524/test_codecs_fix1.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22166] test_codecs "leaking" references

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

ExceptionChainingTest uses a function to raise an arbitrary exception. Problem: 
the function and its parameter becomes part of the exception traceback. 
Shortly, the exception links indirectly to itself in a nice reference cycle...

Example:
---
import traceback

class Err(Exception):
def __del__(self):
print("del")

def raise_exc(exc):
raise exc

e = Err()
try:
raise_exc(e)
except Exception as e:
t = e.__traceback__
#traceback.clear_frames(t)
e = None
print("exit")
---

Uncommand the call the clear_frames() to see the exception deleted before the 
exit.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22290] "AMD64 OpenIndiana 3.x" buildbot: assertion failed in PyObject_Call() in test_subprocess.test_preexec()

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

Oh, a lot of tests fail with MemoryError on this buildbot. It may explain this 
issue.

For example, test_json crashed with SIGSEGV in this build, probably because of 
an unhandled MemoryError exception:
http://buildbot.python.org/all/builders/AMD64%20OpenIndiana%203.x/builds/8557/steps/test/logs/stdio

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22324] Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

wchar_posixmodule.patch: patch for posixmodule.c. Sorry, the code calling 
PyUnicode_AsUnicode() was not generated by Argument Clinic in fact.

--
Added file: http://bugs.python.org/file36523/wchar_posixmodule.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22324] Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I didn't generated wchar.patch correctly: please ignore changes in the 
unicodeobject.c files. These changes are part of issues #22271 and #22323.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22278] urljoin duplicate slashes

2014-09-01 Thread Demian Brecht

Demian Brecht added the comment:

I'll try to get some time this week to extend the various test cases, thanks 
for pointing that out Antoine.

I also found that, other than the few RFC-specific blocks in the link that Nick 
added in the other ticket, not only were they questionable (non-HTTP as Antoine 
pointed out), but they were also just plain wrong in some cases given the new 
semantics.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22324] Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()

2014-09-01 Thread STINNER Victor

New submission from STINNER Victor:

I would like to deprecate PyUnicode_AsUnicode(), see the issue #22271 for the 
rationale (hint: memory footprint).

To deprecate PyUnicode_AsUnicode(), we should stop using it internally.

The attached patch is a work-in-progress patch, untested on Windows (only 
tested on Linux). It gives an idea of how many files should be modified.

TODO:

* Modify posixmodule.c: I don't understand how the Argument Clinic generates 
the call to PyUnicode_AsUnicode() when the parameter type is declared as 
"unicode". What is the "unicode" type? Where is the code generating the call to 
PyUnicode_AsUnicode()?

* Modify a few other files.

--
files: wchar.patch
keywords: patch
messages: 226247
nosy: haypo, loewis
priority: normal
severity: normal
status: open
title: Use PyUnicode_AsWideCharString() instead of PyUnicode_AsUnicode()
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file36522/wchar.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22154] ZipFile.open context manager support

2014-09-01 Thread Mike Short

Mike Short added the comment:

Context manager comment & code snippet added to zipfile doc - patch attached.

--
keywords: +patch
nosy: +Mike.Short
Added file: http://bugs.python.org/file36521/zipfile.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22271] Deprecate PyUnicode_AsUnicode(): emit a DeprecationWarning

2014-09-01 Thread STINNER Victor

STINNER Victor added the comment:

> The deprecate PyUnicode_AsUnicode(), we should stop using it in Python itself.

Here is the first step: issue #22323, "rewrite PyUnicode_AsWideChar() and 
PyUnicode_AsWideCharString()" (to not call PyUnicode_AsUnicode() anymore).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22323] Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()

2014-09-01 Thread STINNER Victor

New submission from STINNER Victor:

I would like to deprecate PyUnicode_AsUnicode(), see the issue #22271 for the 
rationale (hint: memory footprint). The first step is to rewrite 
PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() to not call 
PyUnicode_AsUnicode() anymore.

Attached patch implements this.

The code is based on PyUnicode_AsUnicode(), but it's more tricky because 
PyUnicode_AsWideChar() can truncate the string, and PyUnicode_AsUnicode() does 
no copy characters if kind == sizeof(wchar_t), PyASCIIObject.wstr "just" points 
to data.

I hate PyUnicode_AsWideChar(), but we must keep it for backward compatibility 
:-)

It would be possible to write an optimized PyUnicode_AsWideCharString() which 
computes the length, allocate memory and write wide characters, but I don't 
want to have 3 functions converting a Python string to a wide character string. 
There are already PyUnicode_AsUnicodeAndSize() and unicode_aswidechar() (+ 
unicode_aswidechar_len()).

--
messages: 226244
nosy: haypo, loewis
priority: normal
severity: normal
status: open
title: Rewrite PyUnicode_AsWideChar() and PyUnicode_AsWideCharString()
type: enhancement
versions: Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22302] Windows os.path.isabs UNC path bug

2014-09-01 Thread Akima

Akima added the comment:

I checked for the existence of this bug in 2 other python versions today.  It's 
present in CPython 3.4.1, but CPython 2.7.5 doesn't exhibit the issue.


Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on 
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.isabs(r"\\server")
True
>>> os.path.isabs(r"\\server\share")
True
>>> os.path.isabs(r"\\server\share\folder")
True
>>> os.path.isabs(r"\\server\share\folder\folder")
True
>>>


Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 bit 
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os.path
>>> os.path.isabs(r"\\server")
True
>>> os.path.isabs(r"\\server\share")
False
>>> os.path.isabs(r"\\server\share\folder")
True
>>> os.path.isabs(r"\\server\share\folder\folder")
True
>>>

--
versions: +Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22301] smtplib.SMTP.starttls' documentation is just confusing

2014-09-01 Thread Michele Orrù

Michele Orrù added the comment:

"R. David Murray"  writes:

> Since we want to encourage people to use the context, that sounds
> reasonable for 3.x at least. 
Concerning this specific proposition, I really don't see the point in
having .starttls() not simply accepting a SSLContext as argument, as
imaplib.IMAP4.starttls is already doing, for example.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22293] unittest.mock: use slots in MagicMock to reduce memory footprint

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> This means that by the end of a run, we have quite a lot of references to 
> MagicMocks.

It sounds like you are bitten by unittest keeping references to all past 
TestCase instances. This has been fixed recently (see #11798).

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22278] urljoin duplicate slashes

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Those tests don't seem to bring much. Part of them are straight from the RFC 
(and therefore already in the current test suite, I assume), part of them are 
for non-HTTP protocols such as "fred" (!). A couple of them seem to be genuine, 
although only one fails and it's a corner case.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22311] Pip 404's

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

No need to keep this open, this is tackled in issue 22278.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22311] Pip 404's

2014-09-01 Thread Donald Stufft

Donald Stufft added the comment:

Ok, I'll pull down Python 3.5 in a bit and see what is what.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21965] Add support for Memory BIO to _ssl

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> We can leave these undocumented at the Python level if you prefer.

I'd rather that indeed. If there's a specific need, we can expose them as a 
separate issue.

> Maybe just "SSLInstance", would that be better than "SSLObject"?

That doesn't sound much better :-) Ok, let's keep SSLObject then.

> I believe that the overall _ssl/ssl code could be simplified by: [snip]

That would be nice. Would that also handle e.g. socket timeouts?

> To use SSLObject as a mixin it would have to be aware of these two uses of 
> its subclasses. It could be done but I don't think it's 100% clean either.

Fair enough. We just have to make sure to implement and test new APIs twice 
(e.g the version() method in issue20421).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22311] Pip 404's

2014-09-01 Thread Stefan Behnel

Stefan Behnel added the comment:

CPython 3.5, latest development versions. This started failing on August 21st, 
presumably with the changes for issue 22118.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19494] urllib2.HTTPBasicAuthHandler (or urllib.request.HTTPBasicAuthHandler) doesn't work with GitHub API v3 and similar

2014-09-01 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy:  -terry.reedy

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22311] Pip 404's

2014-09-01 Thread Donald Stufft

Donald Stufft added the comment:

Yea can you give more information? How are you reproducing this? What version 
of Python? I can't reproduce it locally.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5950] Make zipimport work with zipfile containing comments

2014-09-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See issue22322 for yet one use case ("git archive" creates ZIP file with 
archive comment).

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22322] Zip files created by `git archive` result in a SyntaxError (due to comment?)

2014-09-01 Thread R. David Murray

R. David Murray added the comment:

You are correct. zipimport does not support zip files with comments.  There is 
already an open issue (issue 5950) for adding support for this.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Make zipimport work with zipfile containing comments

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22321] odd result for datetime.time.strftime("%s")

2014-09-01 Thread R. David Murray

R. David Murray added the comment:

I believe this is effectively a duplicate of issue 12750.  That is, python 
doesn't do anything in particular with %s, it just lets the platform do what it 
will.  Issue 12750 is about making what it does consistent and cross-platform.

(On gentoo linux I get -1 from your examples for both python2 and python3.)

You should any any further comments to issue 12750.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> datetime.strftime('%s') should respect tzinfo

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22322] Zip files created by `git archive` result in a SyntaxError (due to comment?)

2014-09-01 Thread Peter Wu

New submission from Peter Wu:

Files created by `git archive` are not understood by the Python interpreter. 
This could be caused by the additional comment (for the commit hash) in the 
file.

echo 'print(1)' > __main__.py
git init && git add __main__.py && git commit -m init
git archive --format=zip HEAD > y.zip
python y.zip

Packing it with `zip x.zip __main__.py && python x.zip` works.

--
components: Extension Modules
messages: 226230
nosy: lekensteyn
priority: normal
severity: normal
status: open
title: Zip files created by `git archive` result in a SyntaxError (due to 
comment?)
type: behavior
versions: Python 2.7, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19494] urllib2.HTTPBasicAuthHandler (or urllib.request.HTTPBasicAuthHandler) doesn't work with GitHub API v3 and similar

2014-09-01 Thread Ian Cordasco

Ian Cordasco added the comment:

> However, one sticking point is whether that optimization may also have 
> adverse effects in terms of security (since we would always be sending auth 
> headers, even when the server doesn't ask for it...).

Antoine's concern has always been a concern of mine. There's an important part 
of this discussion that seems to have been left off. Even security conscious 
websites like GitHub do not return 404s for all endpoints that require you to 
authenticate. That fact aside, I think seeing how popular the package Matej 
added to PyPI will be a good way to decide how essential this is to add to 
Python 2.7. I am of course biased as a requests core developer and a 
large-scale GitHub API consumer, but I think this is a fairer way to make a 
decision.

The patch for Python 3.5, however, looks great.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19494] urllib2.HTTPBasicAuthHandler (or urllib.request.HTTPBasicAuthHandler) doesn't work with GitHub API v3 and similar

2014-09-01 Thread Ian Cordasco

Changes by Ian Cordasco :


--
nosy: +icordasc

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22319] mailbox.MH chokes on directories without .mh_sequences

2014-09-01 Thread Tim Chase

Tim Chase added the comment:

I had to tweak the example reproduction code as it seemed to succeed (i.e., 
fail to demonstrate the problem) in some instances.  The same exception occurs, 
but here's the full original traceback:


$ cd /home/tim/.claws-mail/imapcache/mail.example.com/t...@example.com/INBOX/

$ python3
Python 3.2.3 (default, Feb 20 2013, 14:44:27) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import mailbox
>>> m = mailbox.MH('.')
>>> for msg in m:
... print(msg)
... 
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.2/mailbox.py", line 114, in itervalues
value = self[key]
  File "/usr/lib/python3.2/mailbox.py", line 78, in __getitem__
return self.get_message(key)
  File "/usr/lib/python3.2/mailbox.py", line 1019, in get_message
for name, key_list in self.get_sequences().items():
  File "/usr/lib/python3.2/mailbox.py", line 1128, in get_sequences
f = open(os.path.join(self._path, '.mh_sequences'), 'r')
IOError: [Errno 2] No such file or directory: 
'/home/tim/.claws-mail/imapcache/mail.example.com/t...@example.com/INBOX/.mh_sequences'

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Akira Li

Akira Li added the comment:

The last example assumes that time.gmtime(0) is 1970-01-01 00:00:00Z
(otherwise time.time() may return different timestamp)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Akira Li

Akira Li added the comment:

timestamp() method works correctly for an aware datetime objects
as in my example (notice: timezone.utc in the code).

The issue is not that it is a manual computation,
the issue is that it is incorrect:

  #XXX WRONG, DO NOT DO IT
  time.mktime(datetime.datetime.utcnow().timetuple())

On older Python versions, given a utc time as a naive datetime
object, POSIX timestamp is:

  ts = (utc_dt - datetime(1970, 1, 1)).total_seconds()
  utc_dt = datetime(1970, 1, 1) + timedelta(seconds=ts) # in reverse

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note the .timestamp() method will work correctly if the datetime object is 
expressed in *local time*, which is not what Rebecka's code uses. Otherwise the 
incantation is a bit more complex:

https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp

(also .timestamp() doesn't exist in 2.7, in which case the manual computation 
must also be used)

--
nosy: +pitrou

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20215] Python2.7 socketserver can not listen IPv6 address

2014-09-01 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +neologix

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20020] "modernize" the modulefinder module

2014-09-01 Thread Berker Peksag

Changes by Berker Peksag :


--
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17396] modulefinder fails if module contains syntax error

2014-09-01 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage:  -> patch review
type:  -> behavior
versions: +Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22321] odd result for datetime.time.strftime("%s")

2014-09-01 Thread Dima Tisnek

New submission from Dima Tisnek:

$ python2 -c 'import datetime; print datetime.time(10, 44, 11).strftime("%s")'
-2208955189

$ python3 -c 'import datetime; print (datetime.time(10, 44, 11).strftime("%s"))'
-2208955189

So apparently, datetime.time(...).strftime("%s") semantically "seconds since 
unix epoch" assumes Jan 1, 1900 for missing date part.

However datetime module doesn't allow subtracting time objects, i.e. no 
assumption of date is made, where "same date" chould be reasonable.

--
components: Extension Modules
messages: 226224
nosy: Dima.Tisnek
priority: normal
severity: normal
status: open
title: odd result for datetime.time.strftime("%s")
type: behavior
versions: Python 2.7, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20567] test_idle causes test_ttk_guionly 'can't invoke "event" command: application has been destroyed' messages from Tk

2014-09-01 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions: +Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19447] py_compile.compile raises if a file has bad encoding

2014-09-01 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19447] py_compile.compile raises if a file has bad encoding

2014-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2d0bcb653085 by Berker Peksag in branch '3.4':
Issue #19447: Suppress output of py_compile.compile().
http://hg.python.org/cpython/rev/2d0bcb653085

New changeset a8ef9d7c4d20 by Berker Peksag in branch 'default':
Issue #19447: Suppress output of py_compile.compile().
http://hg.python.org/cpython/rev/a8ef9d7c4d20

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Akira Li

Akira Li added the comment:

time.time() returns the current time in seconds since Epoch
it is neither local nor UTC time. It can be converted to both.

You can get local time using datetime.fromtimestamp(ts).
You can get UTC time using datetime.utcfromtimestamp(ts) or
to get an aware datetime object: datetime.fromtimestamp(ts, timezone.utc), 
where ts is the timestamp in seconds since Epoch.

I don't know whether there is an issue with cookie.is_expired() but it
is incorrect to use time.mktime() with UTC time tuple unless the local
time is UTC. To get the timestamp from a datetime object, you could
use .timestamp() method instead:

  from datetime import datetime, timezone

  now = datetime.now(timezone.utc) # the current time
  seconds_since_epoch = now.timestamp()
  seconds_since_epoch = time.time() # might be less precise

--
nosy: +akira

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21400] Code coverage documentation is out-of-date.

2014-09-01 Thread Heather McCartney

Heather McCartney added the comment:

Here's a patch with a suggestion for the new text, with the part about the code 
coverage website removed.

Once that part was gone, I found the remainder slightly easier to read when the 
options were presented the other way around, so the simpler (although slower) 
option to run all the tests with coverage appears first. But I'm happy to 
change this (or anything else) if you feel that would be better.

--
keywords: +patch
nosy: +hmcc
Added file: http://bugs.python.org/file36520/issue21400-1.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22293] unittest.mock: use slots in MagicMock to reduce memory footprint

2014-09-01 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
stage:  -> needs patch
versions: +Python 3.5 -Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22306] Inconsistent division by 0 behaviour in decimal module

2014-09-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> Sorry.  Scratch my last comment.  I see from the docs
>  ( https://docs.python.org/3/library/decimal.html )
>vthat the decimal module explicitly references that IBM spec. 
> I imagine that standard python arithmatic doesn't even attempt 
> to conform to this ibm spec.

That is exactly correct.

Closing as not-a-bug.

--
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18615] sndhdr.whathdr could return a namedtuple

2014-09-01 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The patch looks good.  I'll apply it shortly.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20215] Python2.7 socketserver can not listen IPv6 address

2014-09-01 Thread Andreas Røsdal

Andreas Røsdal added the comment:

Is there any interest in this patch? it would be nice with a review of the 
patch.  :)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20567] test_idle causes test_ttk_guionly 'can't invoke "event" command: application has been destroyed' messages from Tk

2014-09-01 Thread Andrea Torre

Andrea Torre added the comment:

Ubuntu 12.04 64-bit
Python 2.7.3 (virtualenv)

Hi, just adding a few info, hope not completely useless, that seem related to 
the issue. I got the same message when running nosetests against my source. 
It's an application using Tkinter as frontend. All tests pass, though. Besides, 
I always destroy root in tearDown(). 

I noticed that the the issue only comes up when i run tests without specifying 
any path, like in nosetests -vs.

If i enter nosetests -vs tests/unit/ tests/integration/ everything runs smooth.

--
nosy: +andtorg
versions:  -Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22311] Pip 404's

2014-09-01 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +dstufft

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10240] dict.update.__doc__ is misleading

2014-09-01 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22320] Invalid link in General Python FAQ

2014-09-01 Thread Josh Lynn

Josh Lynn added the comment:

No problem! Thank you!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22320] Invalid link in General Python FAQ

2014-09-01 Thread Ned Deily

Ned Deily added the comment:

Thanks again for the patch!  (I did change the wording slightly.)

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22320] Invalid link in General Python FAQ

2014-09-01 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 241f9aa9fb89 by Ned Deily in branch '2.7':
Issue #22320: Fix broken link in the General Python FAQ.
http://hg.python.org/cpython/rev/241f9aa9fb89

New changeset 3eaba8a0cb3a by Ned Deily in branch '3.4':
Issue #22320: Fix broken link in the General Python FAQ.
http://hg.python.org/cpython/rev/3eaba8a0cb3a

New changeset c81e2b6eccd8 by Ned Deily in branch 'default':
Issue #22320: merge from 3.4
http://hg.python.org/cpython/rev/c81e2b6eccd8

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22296] cookielib uses time.time(), making incorrect checks of expiration times in cookies

2014-09-01 Thread Rebecka

Rebecka added the comment:

I've checked and an updated test file for 3.4 shows the same behaviour in the 
renamed module http.cookiejar.

Even though no standard exists I hope 3.4+ would be changed to simplify the 
cookie handling, since there is a lot of hassle converting UTC times to local 
times (which in general should be avoided to avoid introducing further problems 
with e.g. daylight savings).

--
Added file: http://bugs.python.org/file36519/cookie_timestamp_test_3.4.py

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com