Author: Philip Jenvey <[email protected]>
Branch:
Changeset: r65910:56e444747761
Date: 2013-08-02 11:51 -0700
http://bitbucket.org/pypy/pypy/changeset/56e444747761/
Log: issue1573: cursor description names should be plain strs
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -1305,7 +1305,7 @@
for i in xrange(_lib.sqlite3_column_count(self._statement)):
name = _lib.sqlite3_column_name(self._statement, i)
if name:
- name = _ffi.string(name).decode('utf-8').split("[")[0].strip()
+ name = _ffi.string(name).split("[")[0].strip()
desc.append((name, None, None, None, None, None, None))
return desc
diff --git a/pypy/module/test_lib_pypy/test_sqlite3.py
b/pypy/module/test_lib_pypy/test_sqlite3.py
--- a/pypy/module/test_lib_pypy/test_sqlite3.py
+++ b/pypy/module/test_lib_pypy/test_sqlite3.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
"""Tests for _sqlite3.py"""
import pytest, sys
@@ -222,3 +223,8 @@
cur.execute("create table test(a)")
cur.executemany("insert into test values (?)", [[1], [2], [3]])
assert cur.lastrowid is None
+
+def test_issue1573(con):
+ cur = con.cursor()
+ cur.execute(u'SELECT 1 as méil')
+ assert cur.description[0][0] == u"méil".encode('utf-8')
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit