Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 833816e

Browse filesBrowse files
authored
Move _mysql and _mysql_exceptions into MySQLdb/ (PyMySQL#293)
1 parent bd62c5d commit 833816e
Copy full SHA for 833816e
Expand file treeCollapse file tree

14 files changed

+25
-24
lines changed

‎MySQLdb/__init__.py

Copy file name to clipboardExpand all lines: MySQLdb/__init__.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
from MySQLdb.release import __version__, version_info, __author__
1717

18-
import _mysql
18+
from . import _mysql
1919

2020
if version_info != _mysql.version_info:
2121
raise ImportError("this is MySQLdb version %s, but _mysql is version %r" %
@@ -25,7 +25,7 @@
2525
apilevel = "2.0"
2626
paramstyle = "format"
2727

28-
from _mysql import *
28+
from ._mysql import *
2929
from MySQLdb.compat import PY2
3030
from MySQLdb.constants import FIELD_TYPE
3131
from MySQLdb.times import Date, Time, Timestamp, \

‎_mysql.c renamed to ‎MySQLdb/_mysql.c

Copy file name to clipboardExpand all lines: MySQLdb/_mysql.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2746,7 +2746,7 @@ init_mysql(void)
27462746
(PyObject *)&_mysql_ResultObject_Type))
27472747
goto error;
27482748
Py_INCREF(&_mysql_ResultObject_Type);
2749-
if (!(emod = PyImport_ImportModule("_mysql_exceptions"))) {
2749+
if (!(emod = PyImport_ImportModule("MySQLdb._mysql_exceptions"))) {
27502750
PyErr_Print();
27512751
goto error;
27522752
}
File renamed without changes.

‎MySQLdb/connections.py

Copy file name to clipboardExpand all lines: MySQLdb/connections.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@
77
import re
88
import sys
99

10-
from MySQLdb import cursors
10+
from MySQLdb import cursors, _mysql
1111
from MySQLdb.compat import unicode, PY2
12-
from _mysql_exceptions import (
12+
from MySQLdb._mysql_exceptions import (
1313
Warning, Error, InterfaceError, DataError,
1414
DatabaseError, OperationalError, IntegrityError, InternalError,
1515
NotSupportedError, ProgrammingError,
1616
)
17-
import _mysql
1817

1918

2019
if not PY2:

‎MySQLdb/converters.py

Copy file name to clipboardExpand all lines: MySQLdb/converters.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
MySQL.connect().
3232
"""
3333

34-
from _mysql import string_literal, escape, NULL
34+
from MySQLdb._mysql import string_literal, escape, NULL
3535
from MySQLdb.constants import FIELD_TYPE, FLAG
3636
from MySQLdb.times import *
3737
from MySQLdb.compat import PY2, long

‎MySQLdb/cursors.py

Copy file name to clipboardExpand all lines: MySQLdb/cursors.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import re
99
import sys
1010

11-
from MySQLdb.compat import unicode
12-
from _mysql_exceptions import (
11+
from .compat import unicode
12+
from ._mysql_exceptions import (
1313
Warning, Error, InterfaceError, DataError,
1414
DatabaseError, OperationalError, IntegrityError, InternalError,
1515
NotSupportedError, ProgrammingError)
@@ -55,9 +55,11 @@ class BaseCursor(object):
5555
#: Default value of max_allowed_packet is 1048576.
5656
max_stmt_length = 64*1024
5757

58-
from _mysql_exceptions import MySQLError, Warning, Error, InterfaceError, \
59-
DatabaseError, DataError, OperationalError, IntegrityError, \
60-
InternalError, ProgrammingError, NotSupportedError
58+
from ._mysql_exceptions import (
59+
MySQLError, Warning, Error, InterfaceError,
60+
DatabaseError, DataError, OperationalError, IntegrityError,
61+
InternalError, ProgrammingError, NotSupportedError,
62+
)
6163

6264
_defer_warnings = False
6365
connection = None

‎MySQLdb/times.py

Copy file name to clipboardExpand all lines: MySQLdb/times.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77
from time import localtime
88
from datetime import date, datetime, time, timedelta
9-
from _mysql import string_literal
9+
from MySQLdb._mysql import string_literal
1010

1111
Date = date
1212
Time = time

‎doc/user_guide.rst

Copy file name to clipboardExpand all lines: doc/user_guide.rst
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ Installation
1717
The ``README`` file has complete installation instructions.
1818

1919

20-
_mysql
21-
------
20+
MySQLdb._mysql
21+
--------------
2222

2323
If you want to write applications which are portable across databases,
24-
use MySQLdb_, and avoid using this module directly. ``_mysql``
24+
use MySQLdb_, and avoid using this module directly. ``MySQLdb._mysql``
2525
provides an interface which mostly implements the MySQL C API. For
2626
more information, see the `MySQL documentation`_. The documentation
2727
for this module is intentionally weak because you probably should use

‎metadata.cfg

Copy file name to clipboardExpand all lines: metadata.cfg
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ classifiers:
3131
Topic :: Database
3232
Topic :: Database :: Database Engines/Servers
3333
py_modules:
34-
_mysql_exceptions
34+
MySQLdb._mysql_exceptions
3535
MySQLdb.compat
3636
MySQLdb.connections
3737
MySQLdb.converters

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
readme = f.read()
1515

1616
metadata, options = get_config()
17-
metadata['ext_modules'] = [setuptools.Extension(sources=['_mysql.c'], **options)]
17+
metadata['ext_modules'] = [
18+
setuptools.Extension("MySQLdb._mysql", sources=['MySQLdb/_mysql.c'], **options)
19+
]
1820
metadata['long_description'] = readme
1921
metadata['long_description_content_type'] = "text/markdown"
2022
setuptools.setup(**metadata)

‎setup_posix.py

Copy file name to clipboardExpand all lines: setup_posix.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,14 @@ def get_config():
9494
create_release_file(metadata)
9595
del metadata['version_info']
9696
ext_options = dict(
97-
name = "_mysql",
9897
library_dirs = library_dirs,
9998
libraries = libraries,
10099
extra_compile_args = extra_compile_args,
101100
extra_link_args = extra_link_args,
102101
include_dirs = include_dirs,
103102
extra_objects = extra_objects,
104103
define_macros = define_macros,
105-
)
104+
)
106105

107106
# newer versions of gcc require libstdc++ if doing a static build
108107
if static:

‎setup_windows.py

Copy file name to clipboardExpand all lines: setup_windows.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,14 @@ def get_config():
3535
create_release_file(metadata)
3636
del metadata['version_info']
3737
ext_options = dict(
38-
name = "_mysql",
3938
library_dirs = library_dirs,
4039
libraries = libraries,
4140
extra_compile_args = extra_compile_args,
4241
extra_link_args = extra_link_args,
4342
include_dirs = include_dirs,
4443
extra_objects = extra_objects,
4544
define_macros = define_macros,
46-
)
45+
)
4746
return metadata, ext_options
4847

4948
if __name__ == "__main__":

‎tests/test_MySQLdb_nonstandard.py

Copy file name to clipboardExpand all lines: tests/test_MySQLdb_nonstandard.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22

3-
import _mysql
3+
from MySQLdb import _mysql
44
import MySQLdb
55
from MySQLdb.constants import FIELD_TYPE
66
from configdb import connection_factory

‎tests/test__mysql.py

Copy file name to clipboardExpand all lines: tests/test__mysql.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pytest
2-
import _mysql
2+
from MySQLdb import _mysql
33

44

55
def test_result_type():

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.