[issue21492] email.header.decode_header sometimes returns bytes, sometimes str

2014-05-13 Thread Jim Minter

New submission from Jim Minter:

Python 3.3.2 (default, Mar  5 2014, 08:21:05) 
[GCC 4.8.2 20131212 (Red Hat 4.8.2-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import email.header
>>> email.header.decode_header("foo")
[('foo', None)]
>>> email.header.decode_header("foo=?windows-1252?Q?bar?=")
[(b'foo', None), (b'bar', 'windows-1252')]

I may well be wrong, but I believe it's erroneous that in the second example 
above, b'foo' is returned instead of the expected 'foo'.

--
components: Library (Lib)
messages: 218419
nosy: jim_minter
priority: normal
severity: normal
status: open
title: email.header.decode_header sometimes returns bytes, sometimes str
type: behavior
versions: Python 3.3

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



[issue16864] sqlite3.Cursor.lastrowid isn't populated when executing a SQL REPLACE statement

2013-01-04 Thread Jim Minter

New submission from Jim Minter:

sqlite3 doesn't populate the lastrowid member of the Cursor object when a SQL 
REPLACE statement is executed.

The following snippet doesn't work as I would expect:
cursor = db.execute("REPLACE INTO table(column) VALUES ('datum')")
print cursor.lastrowid  # prints None

The following snippet, with SQL which is in effect identical to SQLite, does 
work as expected:
cursor = db.execute("INSERT OR REPLACE INTO table(column) VALUES ('datum')")
print cursor.lastrowid  # prints some rowid

Looking at Modules/_sqlite/cursor.c, in _pysqlite_query_execute(), the 
following snippet is found:

if (!multiple && statement_type == STATEMENT_INSERT) {
Py_BEGIN_ALLOW_THREADS
lastrowid = sqlite3_last_insert_rowid(self->connection->db);
Py_END_ALLOW_THREADS
self->lastrowid = PyLong_FromLong((long)lastrowid);
} else {
Py_INCREF(Py_None);
self->lastrowid = Py_None;
}

I suggest this should read something like:
if (!multiple && (statement_type == STATEMENT_INSERT || statement_type == 
STATEMENT_REPLACE)) {
instead of:
if (!multiple && statement_type == STATEMENT_INSERT) {

Thanks,

Jim

--
components: Library (Lib)
messages: 179049
nosy: jim_minter
priority: normal
severity: normal
status: open
title: sqlite3.Cursor.lastrowid isn't populated when executing a SQL REPLACE 
statement
type: enhancement
versions: Python 2.7, Python 3.3

___
Python tracker 
<http://bugs.python.org/issue16864>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24905] Allow incremental I/O to blobs in sqlite3

2015-08-21 Thread Jim Minter

New submission from Jim Minter:

SQLite supports incremental I/O to blobs, i.e. the capability to stream reads 
and writes to blobs without having to load the entire blob into memory first.  
See https://www.sqlite.org/c3ref/blob_open.html for more details on the C API.

It'd be nice if it were possible to do this in Python using sqlite3 (it is 
already possible with apsw).

--
messages: 248945
nosy: jim_minter
priority: normal
severity: normal
status: open
title: Allow incremental I/O to blobs in sqlite3
type: enhancement
versions: Python 3.6

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