mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 00:46:33 +03:00
Merge branch 'master' into rm-2.7
This commit is contained in:
commit
8830e30f73
|
@ -21,7 +21,7 @@ environment:
|
|||
- {APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015, PY_VER: "36", PY_ARCH: "64"}
|
||||
|
||||
OPENSSL_VERSION: "1_1_1h"
|
||||
POSTGRES_VERSION: "11_4"
|
||||
POSTGRES_VERSION: "13_0"
|
||||
|
||||
PSYCOPG2_TESTDB: psycopg2_test
|
||||
PSYCOPG2_TESTDB_USER: postgres
|
||||
|
|
4
NEWS
4
NEWS
|
@ -5,6 +5,10 @@ What's new in psycopg 2.9
|
|||
-------------------------
|
||||
|
||||
- Dropped support for Python 2.7, 3.4, 3.5 (:tickets:#1198, #1000, #1197).
|
||||
- Reclassified SQLSTATE connection exceptions (08XXX) as
|
||||
`~psycopg2.errors.OperationalError` (subclass of previously used
|
||||
`~psycopg2.errors.DatabaseError`) (:ticket:`#1148`).
|
||||
|
||||
|
||||
What's new in psycopg 2.8.6
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
|
@ -65,6 +65,8 @@ base_exception_from_sqlstate(const char *sqlstate)
|
|||
switch (sqlstate[0]) {
|
||||
case '0':
|
||||
switch (sqlstate[1]) {
|
||||
case '8': /* Class 08 - Connection Exception */
|
||||
return OperationalError;
|
||||
case 'A': /* Class 0A - Feature Not Supported */
|
||||
return NotSupportedError;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ OpenSSL
|
|||
Version: 1.1.1h
|
||||
|
||||
PostgreSQL
|
||||
Version: 11.4
|
||||
Version: 13.0
|
||||
|
||||
|
||||
NOTE: to zap the cache manually you can also use:
|
||||
|
|
|
@ -53,6 +53,7 @@ def setup_build_env():
|
|||
str(opt.py_dir / 'Scripts'),
|
||||
r'C:\Strawberry\Perl\bin',
|
||||
r'C:\Program Files\Git\mingw64\bin',
|
||||
str(opt.ssl_build_dir / 'bin'),
|
||||
os.environ['PATH'],
|
||||
]
|
||||
setenv('PATH', os.pathsep.join(path))
|
||||
|
@ -212,7 +213,7 @@ def build_openssl():
|
|||
+ ['no-shared', 'no-zlib', f'--prefix={top}', f'--openssldir={top}']
|
||||
)
|
||||
|
||||
run_command("nmake build_libs install_dev".split())
|
||||
run_command("nmake build_libs install_sw".split())
|
||||
|
||||
assert (top / 'lib' / 'libssl.lib').exists()
|
||||
|
||||
|
@ -249,20 +250,6 @@ def build_libpq():
|
|||
pgbuild = opt.build_dir / f"postgres-REL_{ver}"
|
||||
os.chdir(pgbuild)
|
||||
|
||||
# Patch for OpenSSL 1.1 configuration. See:
|
||||
# https://www.postgresql-archive.org/Compile-psql-9-6-with-SSL-Version-1-1-0-td6054118.html
|
||||
assert Path("src/include/pg_config.h.win32").exists()
|
||||
with open("src/include/pg_config.h.win32", 'a') as f:
|
||||
print(
|
||||
"""
|
||||
#define HAVE_ASN1_STRING_GET0_DATA 1
|
||||
#define HAVE_BIO_GET_DATA 1
|
||||
#define HAVE_BIO_METH_NEW 1
|
||||
#define HAVE_OPENSSL_INIT_SSL 1
|
||||
""",
|
||||
file=f,
|
||||
)
|
||||
|
||||
# Setup build config file (config.pl)
|
||||
os.chdir("src/tools/msvc")
|
||||
with open("config.pl", 'w') as f:
|
||||
|
@ -326,7 +313,7 @@ def build_psycopg():
|
|||
add_pg_config_path()
|
||||
run_python(
|
||||
["setup.py", "build_ext", "--have-ssl"]
|
||||
+ ["-l", "libpgcommon", "-l", "libpgport"]
|
||||
+ ["-l", "libpgcommon libpgport"]
|
||||
+ ["-L", opt.ssl_build_dir / 'lib']
|
||||
+ ['-I', opt.ssl_build_dir / 'include']
|
||||
)
|
||||
|
|
|
@ -62,6 +62,13 @@ class ErrorsTests(ConnectingTestCase):
|
|||
with self.assertRaises(KeyError):
|
||||
errors.lookup('XXXXX')
|
||||
|
||||
def test_connection_exceptions_backwards_compatibility(self):
|
||||
err = errors.lookup('08000')
|
||||
# connection exceptions are classified as operational errors
|
||||
self.assert_(issubclass(err, errors.OperationalError))
|
||||
# previously these errors were classified only as DatabaseError
|
||||
self.assert_(issubclass(err, errors.DatabaseError))
|
||||
|
||||
def test_has_base_exceptions(self):
|
||||
excs = []
|
||||
for n in dir(psycopg2):
|
||||
|
|
Loading…
Reference in New Issue
Block a user