Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A few improvements to the header files. #1222

Open
AraHaan opened this issue May 25, 2023 · 1 comment
Open

A few improvements to the header files. #1222

AraHaan opened this issue May 25, 2023 · 1 comment

Comments

@AraHaan
Copy link

AraHaan commented May 25, 2023

I noticed a few things that can be impoved upon on the C header files:

  • the STRINGIFY macro can be replaced with the Py_STRINGIFY macro which does the exact same thing. (Macro from Python.h)
  • I would like a special version of pyodbc.h header file which can be included with the package so that way people who want to make C extensions that needs to check pyodbc types can with simply including a C header file that defines the package's typeobjects for each python type it creates from the C code. This will help even my own project where I actually need to do such a thing in my C code to check if an argument is pyodbc.Row and error if not. Even ChatGPT if you ask it to help you generate your c code to check the type and see if it's pyodbc.Row will attempt to then #include <pyodbc.h> (does not exist when pip installing pyodbc), and then it will try to do something like PyOdbcRowObject for the type check (which will not work as well).
@mkleehammer
Copy link
Owner

I was not aware of the need for the second bullet. It sounds like we should split the headers into two - one with the very basics that can ship with the product and one with the rest. I'll look into that.

Another option we are looking at is refactoring pydobc to have a private C core that is just functions and a public Python layer with all of the classes like Cursor and Row. That would eliminate the need for the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants