Commit Graph

182 Commits

Author SHA1 Message Date
Emmanuel Briot
9ffcd45e24 (Execute_Expression): new function
Part of P914-027 (1/2)

Change-Id: Id8f53a9c1425a1f9287a802e06615260bcc68210
2016-09-26 16:54:40 +02:00
Emmanuel Briot
1c4f0d5dd3 Minor improvement to error messages
* When a wrong number of arguments is given, we now display the name
  of the python function in the exception message
* When trying to access an invalid argument, we now display the index
  of that argument

Change-Id: I6d4e07f078ebf32e083b4184a33be6f2d152f8a4
2016-09-07 17:38:42 +02:00
Nicolas Setton
edcaf1ea26 Add the local path to sys.path when executing a script file
This allows scripts to do "import bla" for a bla found in the
same directory, as is the behavior of the Python interpreter
running on a script.

For P726-018

Change-Id: I6a9ab2a63703bae6516e0dbcb50311821b5fa029
2016-07-29 13:30:15 -04:00
Nicolas Setton
60aad7c1ee Minor C warning fixes
Change-Id: I0ae0ebe5926ee9227476a7474c28668973a7950c
2016-07-18 19:30:09 -04:00
Pascal Obry
d940bd173b Fix link issue with gnatcoll_python on Windows.
To build a Windows DLL we do not want a single __declspec(dllexport) as
in this case only the routines marked with this attribute will be
exported from the DLL.

For P120-046.

Change-Id: I02ca24cebe2740728bfe6584ea9bbff1e4a9c86e
2016-02-03 12:13:52 +01:00
Emmanuel Briot
aa84b70853 Update copyright year
Change-Id: Ibc7640eaef7ae555da7e11b179d5b153ec98e4ea
2016-01-04 12:03:03 +01:00
Emmanuel Briot
6c0ff5384c Minor memory leak fix
for OB24-013
Add traces to help investigate python issues (list all callbacks from
python to Ada in the traces)

Change-Id: I38c7680a82a520f89f53f54ab06fe7fe3adbe25b
2015-11-24 17:34:20 +01:00
Emmanuel Briot
33b3f2174b Simplify refcounting for Class_Instance
We now use a proper refcounted type rather than do our own refcounting.
This also ensures that a given Ada Class_Instance owns a single reference
to a python object, not one per refcount.

Part of M806-002

Change-Id: Ic8a1d0c7c483fb7b5978f9cbad0c4bbc51dcba6c
2015-11-24 17:34:20 +01:00
Nicolas Setton
e343d02589 Fix memory leak in Python binding for lists
On_PyObject_Data_Destroy is used to decref the data
set in Get_User_Data: this should include Tmp allocated at line 2907.

For OB17-054


Change-Id: Ied389a2669770fb0bc179c3d6ac298ea0204bf85
2015-11-18 03:53:48 +01:00
Raphael Amiard
f153fac722 GNATCOLL.Scripts: New primitive Set_Address_Return_Value
* GNATCOLL.Scripts (Set_Address_Return_Value): New primitive to set a
  return value as an address. Uses a proper type so that the address is
  passed correctly on all platforms. The representation on the script
  side is system dependent.

Implemented to pass Clang translation units from Ada to python.

Change-Id: I3ba72b06ddabf99c1b939286bce817477eb814d1
TN: OB15-005
2015-11-16 17:29:07 +01:00
Vadim Godunko
41f232fee6 N701-028 Change type to avoid Constraint_Error.
Constraint_Error is raised there are no more items in dictionary
available.

Change-Id: Ic98b2c6bd3fb65d1f1bba586c14d87652bb3d1b9
2015-09-30 14:31:29 +03:00
Vadim Godunko
81c303cfd1 O325-004 Subprograms to check presence and obtain values by keys
Change-Id: Id3026b03638cc5162c6aa30f2bcefd0fdcd0f540
2015-07-30 13:22:51 +03:00
Vadim Godunko
4d7241d4e4 O325-004 Minimal support of dictionaries.
Minimal support of Python dictionaries needed for GNATdoc.

Change-Id: I623d55b087e3c94c8d1b0e79e8e0e4dbdb207da2
2015-07-30 13:18:09 +03:00
Vadim Godunko
9f427606e0 Remove direct calls of Ada.Exceptions.Raise_Exception.
Direct calls of Ada.Exceptions.Raise_Exception is replaced by extended
raise statement for consistency with other code.

Change-Id: I5aaba84138ef3b5527a44f43fb50f6d629d50663
2015-07-29 16:49:01 +02:00
Nicolas Setton
293b666877 Fix spelling of "overridden"
Found by Patrick Gautschi under O727-014.

Change-Id: I7be051f1b64a2eef0e6f6a112b9574e723fb16c5
2015-07-29 16:21:39 +02:00
Emmanuel Briot
bc213a8907 Add missing constant keyword 2015-05-13 17:57:38 +02:00
Philippe Gil
1010f715f3 use C function free to release memory allocated by strdup
Part of O512-029

Change-Id: Ia68a7f254eb4f46a38471d464186f9d7bad50aa7
2015-05-12 14:41:24 +02:00
Vadim Godunko
b715307775 Raise exception when requested parameter is dictionary or set.
Part of O325-004.

Change-Id: I4359ed1ef3a2b08b110796c5190c3d4f866d542a
2015-03-31 18:03:19 +03:00
Maxim Reznik
772b966d9b Avoid setting Kw to None to fix O317-012
Kw expected to be dictionary, so setting it to None looks like invalid.
It seems the same fix was applied in another line, where there is
comment:
--  NOT: Py_None, which is not a valid dictionary

Change-Id: I588ecde33c4dab838122e55cff191382ea1417e5
2015-03-18 19:14:20 +02:00
Raphael Amiard
b8c6cdd27b Scripts.Python: Clear exceptions when getting a non existent object method
* GNATCOLL.Scripts.Python (Get_Method): Clear the exception when the
  method was not found. That will allow python execution to continue
  normally

Change-Id: I0fedbb99597e8c5d0e162d1d4c868312eae1bab5
2015-03-11 12:30:22 +01:00
Nicolas Setton
cda44da3e3 Revert "Protect calls with PyGILState_Ensure/_Release"
This reverts commit f2c90461380b7db55a0d36f861e7bcde69c7bdc8.
2015-03-02 08:52:19 -05:00
Nicolas Setton
8c818e0b0c Revert "Protect Python API calls with PyGILState_Ensure/_Release"
This reverts commit 53740babb9acd316b9aefb2a142d3b5063d638a6.
2015-03-02 08:52:14 -05:00
Nicolas Setton
1518ba0d8c Protect Python API calls with PyGILState_Ensure/_Release
Second pass on O218-072.

Change-Id: I4e67fffbb5383cecc423af346a98ebad07fb08c9
2015-02-21 00:30:03 +01:00
Nicolas Setton
cac1170602 Protect calls with PyGILState_Ensure/_Release
First pass on O218-072.

Change-Id: I1daf52f4dce9db80ed525a74f329a370c7e21676
2015-02-18 19:04:38 -05:00
Emmanuel Briot
c4292f179e Update copyright notices to 2015 2015-01-05 11:16:11 +01:00