[issue38828] http.cookiejar handle cookie.version to be None

2019-11-17 Thread Kovid Goyal
Kovid Goyal added the comment: Here's a trivial script to reproduce: from urllib.request import Request from http.cookiejar import Cookie, CookieJar jar = CookieJar() jar.set_cookie(Cookie( None, 'test', 'test', None, False,

[issue38828] http.cookiejar handle cookie.version to be None

2019-11-17 Thread Kovid Goyal
Kovid Goyal added the comment: It's trivially True that it is a regression from python 2 since in python 2 comparison to None is fine. Whether it ever worked in any python 3 version before 3.8 I'm not sure about. -- ___ Python track

[issue38828] cookiejar.py broken in 3.8

2019-11-17 Thread Kovid Goyal
Kovid Goyal added the comment: The issue is obvious with a simple glance at the code. Either the Cookie constructor needs to change version = None to zero or some other integer or the various methods in that module need to handle a None version. I dont personally care about this issue any

[issue38828] cookiejar.py broken in 3.8

2019-11-17 Thread Kovid Goyal
New submission from Kovid Goyal : In python 3.8 cookiejar.py is full of code that compares cookie.version to integers, which raises as exception when cookie.version is None. For example, in set_ok_version() and set_ok_path(). Both the Cookie constructor and _cookie_from_cookie_tuple

[issue28591] imghdr doesn't recognize some jpeg formats

2016-11-02 Thread Kovid Goyal
Kovid Goyal added the comment: FYI, the uptodate version of imghdr I maintain is here: https://github.com/kovidgoyal/calibre/blob/master/src/calibre/utils/imghdr.py It uses memoryview for performance and can also also read image sizes from file headers for jpeg, png, gif and jpeg2000. Note

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-30 Thread Kovid Goyal
Kovid Goyal added the comment: No worries, as I said, I understand, I would probably do the same, were I in your shoes. I have found that being a maintainer of a complex software project tends to naturally increase conservatism :) -- ___ Python

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-30 Thread Kovid Goyal
Kovid Goyal added the comment: I take it back, my methodology in reproducing the function calls used by the gzip module was flawed. It does look like a bug in the CRT, but I have not been able to isolate a simple way of reproducing it. I have however, found a workaround for it, that has an

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal
Kovid Goyal added the comment: Doesn't seem like a bug in the CRT, I cannot reproduce in a plain CRT program, so now I get to try to figure out what is broken in fileobject.c by VS 2015. That's a relief :) -- ___ Python trac

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal
Kovid Goyal added the comment: To answer part of my question, the reason the fseek()+fread() bug does not affect python 3.5.0 appears to be because it implements its own buffering and does not use fseek()/fread() at all. Sigh, I really hope the answer does not end up being that I have to re

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal
Kovid Goyal added the comment: Yes, I am aware. I embed python in my application, which includes large C++ libraries. Those libraries are going to start requiring to be compiled with a modern compiler soon, which means I need python to also be compiled with a modern compiler. I already

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-29 Thread Kovid Goyal
Kovid Goyal added the comment: I missed a few places in my initial patch, updated patch: https://github.com/kovidgoyal/cpython/commit/a9ec814d466d3c0139d10b69666f88eed10e4940 Also fixed the code not clearing errno before calling CRT functions, while I was there. Regardless of whether you want

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Kovid Goyal
Kovid Goyal added the comment: I have it building with just two simple patches: https://github.com/kovidgoyal/cpython/commit/fd1ceca4f21135f12ceb72f37d4ac5ea1576594d https://github.com/kovidgoyal/cpython/commit/edb740218c04b38aa0f385188103100a972d608c However, in developing the patches, I

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Kovid Goyal
Kovid Goyal added the comment: OK, I had hoped to avoid having to maintain my own fork of python 2 for a while longer, but, I guess not. Could you at least tell me if there are any other issues I should be aware of, to avoid me having to search through the python 3 sourcecode/commit history

[issue25759] Python 2.7.11rc1 not building with Visual Studio 2015

2015-11-28 Thread Kovid Goyal
New submission from Kovid Goyal: The Pcbuild/readme.txt file implies that it is possible to build python 2.7.11rc1 with Visual Studio 2015 (although it is not officially supported). However, there are at least a couple of problems, that I have encountered so far: 1) timemodule.c uses

[issue15500] Python should support naming threads

2014-11-06 Thread Kovid Goyal
Kovid Goyal added the comment: Just FYI, a pure python2 implementation that monkey patches Thread.start() to set the OS level thread name intelligently. import ctypes, ctypes.util, threading libpthread_path = ctypes.util.find_library("pthread") if libpt

[issue16512] imghdr doesn't recognize variant jpeg formats

2014-06-21 Thread Kovid Goyal
Kovid Goyal added the comment: You cannot assume the file like object passed to imghdr is seekable. And IMO it is not the job of imghdr to check file validity, especially since it does not do that for all formats. -- ___ Python tracker <h

[issue16512] imghdr doesn't support jpegs with an ICC profile

2014-06-12 Thread Kovid Goyal
Kovid Goyal added the comment: FYI, the test I currently use in calibre, which has not failed so far for millions of users: def test_jpeg(h, f): if (h[6:10] in (b'JFIF', b'Exif')) or (h[:2] == b'\xff\xd8' and (b'JFIF' in h[:32] or b

[issue16512] imghdr doesn't support jpegs with an ICC profile

2013-03-19 Thread Kovid Goyal
Kovid Goyal added the comment: The attached patch is insufficient, for example, it fails on http://nationalpostnews.files.wordpress.com/2013/03/budget.jpeg?w=300&h=1571 Note that the linux file utility identifies a files as "JPEG Image data" if the first two bytes of the file ar

[issue10551] mimetypes read from the registry should not overwrite standard mime mappings

2010-11-30 Thread Kovid Goyal
Kovid Goyal added the comment: I actually had in mind people that (like me) develop primarily on unix and assume that mimetypes works the same way on both windows and unix. Of course, the changed behavior is also a concern. At the very least, I would encourage the addition of a warning to

[issue10551] mimetypes read from the registry should not overwrite standard mime mappings

2010-11-30 Thread Kovid Goyal
Kovid Goyal added the comment: It is, of course, your decision, but IMO, since the mimetypes database in windows appears to be always broken, the default behavior of the mimetypes module in python 2.7 on windows is broken for most (all?) windows installs. For me personally, it doesn't m

[issue10551] mimetypes read from the registry should not overwrite standard mime mappings

2010-11-27 Thread Kovid Goyal
Kovid Goyal added the comment: I apologize for the multiple issue in the ticket. To my mind they were all basically one issue, stemming from the decision to read mimetypes from the registry. Since there are other tickets for the first two issues, I'll change the summary for this iss

[issue10551] mimetypes reading from registry in windows completely broken

2010-11-27 Thread Kovid Goyal
Kovid Goyal added the comment: And what about the third issue? Allow me to elaborate: mimetypes are a relatively standard set of mappings from well known file extensions to MIME descriptors. Reading mimetype mappings from the registry, a location that is writable to by random programs the

[issue10551] mimetypes reading from registry in windows completely broken

2010-11-27 Thread Kovid Goyal
New submission from Kovid Goyal : Hi, I am the primary developer of calibre (http:/calibre-ebook.com) and yesterday I released an upgrade of calibre based on python 2.7. Here is a small sampling of all the diverse errors that my users experienced, related to reading mimetypes from the