You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:
Python: 3.7.5
pyodbc: 4.0.28
OS: Windows 10 Pro, 64-bit
DB: SQL Server 2019 Express
driver: ODBC Driver 17 for SQL Server
Issue
Python allows integers of more-or-less any size. When inserting a very large integer to a table as a parameter (a value larger than an 8 byte integer can contain), the value of -1 is inserted instead. Oddly, an exception is also raised but not one of the standard PEP249 exceptions. I would expect a PEP249 exception to be raised by pyodbc itself and nothing written to the database. Here is the code that reproduces the issue:
Environment
To diagnose, we usually need to know the following, including version numbers. On Windows, be
sure to specify 32-bit Python or 64-bit:
Issue
Python allows integers of more-or-less any size. When inserting a very large integer to a table as a parameter (a value larger than an 8 byte integer can contain), the value of -1 is inserted instead. Oddly, an exception is also raised but not one of the standard PEP249 exceptions. I would expect a PEP249 exception to be raised by pyodbc itself and nothing written to the database. Here is the code that reproduces the issue:
This code outputs:
My guess is that PyLong_AsLongLong is returning -1 (as expected) but then PyErr_Occurred() is not being checked somewhere. Here perhaps?
The text was updated successfully, but these errors were encountered: