41 Commits

Author SHA1 Message Date
Adrien Boulanger
0decdc2341 VA24-029: Fix invalid conversion to C strings
Missing ASCII.NUL to be a valid C string

Change-Id: I70f2368523648d257d3c0b5dc59e10ee76f1db8a
2022-11-02 16:47:26 +01:00
Vadim Godunko
72ba437993 V927-001 Subprogram to create and register Python module.
Change-Id: Ic896a79c72bf85e0f273bfbf85186a9bd222a85b
2022-10-04 22:41:47 +04:00
Vadim Godunko
8313f88587 V927-001 Return correct value and remove unused variable.
Change-Id: Ia7b4a80b904710c235a159f8a1e6318e70d776ae
2022-09-30 10:38:06 +04:00
Adrien Boulanger
c62ce3517a S712-022: Over-referrencing when using old arguments as keywords
Change-Id: I91e966aab0b7e4a4cf231e9ecf3656ddb7982a7a
2022-04-07 15:45:09 +02:00
Adrien Boulanger
d7ee0cd71b S712-022: Fix over-referrenced object in the bindings
- PyObject_GetAttrString returns a new ref which must
be decref'd.
- Over-referrenced class when calling internal method

Change-Id: I16170aaa3e8daeaf4ad02dcc4cfee3f53574574e
2022-04-05 11:48:33 +02:00
Adrien Boulanger
1624f7e808 U914-005: Transition from python 3.7 to 3.9
- Disable the new vectorcall API (the tp_call profile only
supports the old call format).
- Add missing GIL locks
- Manually config python to use utf-8 (this was automatic with
previous versions)

Change-Id: I214b53e1e1b4fbc2a9af1cf1ec8985cff7905a55
2021-12-01 12:08:28 +01:00
Nicolas Setton
1a230fb6c1 U515-001 gracefully handle the absence of a static python lib
Fix a Python error that occurred when the static lib was not
found.

Change-Id: I02096a913e03714a23bf25935cf056e332452dd5
2021-05-26 10:56:34 +01:00
Nicolas Boulenguez
aeea734354 Use ADAFLAGS CFLAGS CPPFLAGS LDFLAGS if they exist in the environment 2021-04-05 15:56:56 +02:00
Nicolas Boulenguez
1adbba0a53 python.gpr: compute one External_As_List instead of many Split.
This is more efficient and readable.
2021-04-05 15:55:44 +02:00
Nicolas Boulenguez
53d37d3ed4 Removed unused OS_Kind external variable.
The related part of setup.py is still required by the imported
gnatcoll.gpr.
2021-04-05 15:55:13 +02:00
Nicolas Boulenguez
bd6661cae4 In library projects, only set version in the relocatable case 2021-04-05 15:54:31 +02:00
Nicolas Boulenguez
92da3a0af8 Explicitly mark projects with the library qualifier 2021-04-05 15:46:19 +02:00
Dmitriy Anisimkov
335f34c0d2 Fix compilation issue in debug mode
no-tn-check

Add Unreferenced mark to unreferenced but necessary variable.

Change-Id: Ia27e62b67544a9ee78f0f7a2276771476a6e62b5
2021-03-23 16:51:44 +01:00
Adrien Boulanger
7a272ebf03 U305-023: Defensive code for the GIL
Trying to ensure/release the GIL when there is no interpreter will
raise an exception.

Change-Id: I4f85bfbfdd799b906848d2038b52825c4c709e54
2021-03-19 12:34:13 +01:00
Adrien Boulanger
fc63e2906b U201-012: Ensure frame state when calling python function.
Most of the commands can only be called if we have the GIL:
retrieve it.
Add a controlled type to automatically retrieve/free the GIL.
Lock every call using Py_INCREF/Py_DECREF.

Change-Id: I8989fcb3eacf6aedbb90056469536144a2795a3f
2021-02-25 11:17:13 +01:00
Adrien Boulanger
45aaa42efc TC15-079: Remove forbidden flags METH_OLDARGS
METH_OLDARGS (0x0, i.e. no flag) was obsolete in python2
and is forbidden with python3.

(no-precommit-check)
Change-Id: I576042492d74ca69bd59ed6ea6264cb7562c650f
2021-02-12 11:18:02 +01:00
Adrien Boulanger
1b4bf35ad9 TC21-029: Fix PyAdaMethodDescrObject function call
The cfunc is stored inside the descriptor when doing:

f = Foo()
f.bar() => cfunc is retrieved via tp_descr_get
Foo.bar(f) => cfunc is retrieved via tp_call

Without defining tp_call it will try to call a
wrapping function without the proper flags.

Change-Id: I164492895cee66dd4d9946b505c6866c2fea768a
2021-02-12 11:14:20 +01:00
Nicolas Setton
911e57fe44 TB10-016 do not link with the python .la in shared mode
Refinement on the previous change: do not pass the Python
static library to the linker if we are in the mode where
we are using the Python shared library.

Change-Id: I05a19d0f69a492106d04e612f299ea32ceeae1ea
2020-11-19 09:41:04 +00:00
Nicolas Setton
6e9769eb5a TB10-016 Make gnatcoll_python.gpr relocatable
Add a project variable to indicate the path to the libpython*.la,
and use this variable to find this when building.

Copy the .la file to the installation destination,
and use the variable to make sure the project generated by gprinstall
finds it.

Change-Id: Ic145f14339091ecb3bf6f10af14916de9fa176d4
2020-11-18 15:55:55 +00:00
Fabien Chouteau
c8425159d5 gnatcoll_*.gpr: rename external GNATCOLL_BUILD into GNATCOLL_BUILD_MODE
To avoid conflict with installed gnatcoll.gpr where GNATCOLL_BUILD means
library type.

Part of S709-037.

Change-Id: I5a0164505bee8e4a93409615e7a9d3b9a85c02f3
2020-09-10 18:41:55 +02:00
Fabien Chouteau
5262835c42 gnatcoll_*.gpr: introduce the GNATCOLL_BUILD external
Like for gnatcoll_core, these externals allow gnatcoll_*.gpr to be used
from a project that defines the BUILD external in an incompatible way.

Part of S709-037.

Change-Id: I409695393fb40d301e280a3f5ac7018e9d7bc81b
2020-08-25 16:07:04 +02:00
Adrien Boulanger
39e71d520d T416-023: Fix test
The test is creating a hidden property which can't be accessed
by at the python level => thus the last check is always wrong:
remove it.

Change-Id: I5dc8eff713e2e55cfcf97c5758a0fc6c463f69a2
2020-08-05 17:36:13 +02:00
Adrien Boulanger
7b0376a444 T416-023: Add python3-bindings tests
Change-Id: Id656b2905eaa4536e37ec00314479a9e248129e3
2020-07-08 17:06:58 +02:00
Adrien Boulanger
912c1b5e6a T612-027: Update library name for python3 bindings
The API between python2 and python3 has significantly changed
and having a different name will prevent dynamic linking issues.

Change-Id: I7ad5f5d470a658abfc67e65206a09919e0a68fe5
2020-07-08 16:53:44 +02:00
Nicolas Roche
78fae807b1 Update testsuite
* Adjust test layout
* Add a test for T701-014
* Add documentation on existing tests

Change-Id: Iafaf003ceec6af038c76bc6899b169865e3294be
2020-07-03 06:31:52 -07:00