139 Commits

Author SHA1 Message Date
a825b849ff Don't use PyTuple_Resize (#436) 2020-07-03 11:20:38 +09:00
c67dbd41f1 Add some gc safety around _mysql__fetch_row (#348)
Users of gc.get_referrers() could cause a SystemError to be raised if this function is running in a different python thread.
2020-02-05 20:38:25 +09:00
1a5ae1daf8 Added to pass ssl_mode in configuration. (#347) 2019-12-03 19:58:32 +09:00
3fb4eb1b11 Use binary type by default for converter input. (#351)
Before *Most* string fields were passed to custom converter functions as "bytes",
everything else was assumed to be valid encoded utf-8 and passed as str.
This could cause issues where some unknown field was not valid utf-8 and
a decode error is triggered where it can't be fixed or avoided by the
end user.

Instead we should short list those fields that we know for sure have to
be str type because the existing converters expect it to be that way.
So all the date conversions, and (NEW)DECIMAL since the python decimal
type will not accept bytes object.

Everything else stays bytes, which is the least suprising and safest
thing to do.
2019-11-29 17:07:05 +09:00
86491882e6 Drop Python 2 support from C source (#406) 2019-11-29 14:24:28 +09:00
edeab3040d Use cp1252 for latin1 charset (#398) 2019-11-18 21:22:39 +09:00
0da81656e9 fix PyMemberDef type of two attributes (#395) 2019-11-08 00:59:46 +09:00
acf4cdcf89 Add 'auth_plugin' option (#389) 2019-10-23 19:19:23 +09:00
b400acddd0 set charset before connect (#382) 2019-08-11 11:23:40 +09:00
62c8c8c62b call mysql_library_init in module initialization (#377) 2019-08-08 21:31:25 +09:00
6f5f48b76c use PY_SSIZE_T_CLEAN (#360)
Fixes #359
2019-06-08 23:53:46 +09:00
b66971ee36 memory leak in ConnectionObject_Initialize when mysql_real_connect fails (#350)
We can't set open=0 after we mysql_init or dealloc will not cleanup the memory.

Also if mysql_init returns NULL we are out of memory and shouldn't set open=1, or we could segfault in dealloc if we didn't seg before that.
2019-03-26 06:46:32 +09:00
e04c5972f5 Add missing break (#346)
Fixes #343
2019-03-19 17:02:44 +09:00
f683ee7826 Fix typo in docstring and minor formatting (#336) 2019-03-03 12:13:38 +09:00
3870135037 Fix windows build (#322) 2019-01-18 20:52:10 +09:00
ea80e8f07a Fix error handling of mysql_real_connect (#317)
Fixes #316
2018-12-17 19:27:54 +09:00
8ad1525c3f Raise ProgrammingError for nan and inf (#314)
* Raise ProgrammingError when inf or nan is passed
  Fixes #246
* Rename _mysql_exceptions -> _exceptions
2018-12-14 16:46:30 +09:00
911bef988c Refactor extension module initialization (#313) 2018-12-13 20:23:46 +09:00
0b6c6656f2 Refactoring JSON support (#312) 2018-12-13 17:40:37 +09:00
4b40c8ce05 Remove _mysql.thread_safe() (#311) 2018-12-13 16:10:58 +09:00
aca63e5d1c Use Py_RETURN_NONE 2018-12-13 12:44:25 +09:00
fe8032430c Reimplement JSON support (#310) 2018-12-13 12:41:53 +09:00
3bea8cd8dd Faster string and int decoder (#305) 2018-12-11 11:50:42 +09:00
ae6b108b56 Remove HAVE_MYSQL_OPT_TIMEOUTS
Drop MySQL<5.1.12 support
2018-12-10 19:08:19 +09:00
819688b630 Simplify converters (#304) 2018-12-07 13:50:05 +09:00
5e8eeac47f Stop using surrogate escape (#302)
It was workaround for `bytes %`.
Since we dropped Python 3.4 support, we can use just `bytes %` now.
2018-12-07 02:39:33 +09:00
c754b25080 Support field name other than UTF-8 (#301) 2018-12-06 02:39:25 +09:00
27e40186e3 Resurrect Connection.fileno() (#300)
This permits low-level access to the underlying network connection.
For example, this can be used to tweak the TCP timeout (TCP_USER_TIMEOUT).
2018-12-05 19:08:35 +09:00
41581254f8 Fix a reference leak in store_result and use_result if result object initialization fails. (#298) 2018-12-05 12:31:33 +09:00
20ee2e307b Fix warnings 2018-12-04 22:06:08 +09:00
16915a0353 Remove fileno, escape_sequence, and escape_dict from Connection (#297) 2018-12-04 21:50:30 +09:00
833816ee87 Move _mysql and _mysql_exceptions into MySQLdb/ (#293) 2018-12-04 20:19:04 +09:00
7a846cf5e3 Allow pip install from git
Merged with modifications from a815269010
2012-10-04 13:34:39 -04:00
cd44524fef Patch 4/4: Fix TEXT vs. BLOB conversion.
This patch assumes an applied patch 3 (https://sourceforge.net/p/mysql-python/patches/79/). Looks a bit like a hack, but the infrastructure doesn't seem to allow anything else. And it works here very well. I'm not sure, how it works with very old mysql versions (<= 4.0).

https://sourceforge.net/p/mysql-python/patches/80/
2012-10-03 13:20:19 -04:00
c05a2c6a50 Patch 3/4: _mysql.c reference counting and exception issues
This patch fixes a reference leak and improves the error handling in the converter mapping code. Rather accidentially it also drops the cleanup: label and the gotos ;)

https://sourceforge.net/p/mysql-python/patches/79/
2012-10-03 13:17:35 -04:00
8041cc6df6 Some (many) tests actually pass now on Python 3. May no longer be backwards-compatible with Python < 2.6. 2012-09-08 20:24:45 +00:00
fe917fcced _mysql imports now, but still crashes 2012-09-08 18:44:34 +00:00
a5c7996f60 Fix import _mysql SystemError so that now we get the ImportError... 2012-09-08 18:16:28 +00:00
ece1e0e08b _mysql.c compiles and links with Python 3.2.3 now. Need to fix the Python code now... 2012-09-08 16:55:16 +00:00
c1d15552e6 A couple more Python 3 fixes. 2012-09-07 22:48:55 +00:00
66abb0e8d0 A lot more Python 3 fixes for _mysql. It still ain't fixed or broken yet (for Python <3) 2012-09-07 22:09:31 +00:00
9737a4cb39 Some Python 3 fixes for _mysql. It ain't fixed but at least it ain't broken yet (for Python <3) 2012-09-07 20:19:56 +00:00
c12e7cca7e Force HAVE_OPENSSL if the client library is 5.5 or newer. Fixes #3535584. 2012-09-07 17:09:13 +00:00
e6d24c358d Fix: Error is not checked if mysql_store_result returns NULL (#3546166) 2012-09-07 16:53:15 +00:00
11ade40463 Windows build fixes. 2012-09-05 00:38:57 +00:00
1a728edd49 Unpack kill argument into an unsigned long correctly.
SF bug #2902635
2009-12-08 00:17:13 +00:00
29b884d0cc Defer adding references until after all our C calls so we can avoid having
to decrement them if we bail out early.

Fixes bug 2811033.
2009-07-24 00:18:07 +00:00
f19386dd83 2009-03-30 23:01:58 +00:00
7d57743ff4 Fix bug 1808476 for OSX compilation, ported from trunk. 2009-02-24 02:48:29 +00:00
e9c57bd414 don't leak special-case tuples (present in unicode modes) 2009-02-23 23:39:00 +00:00