Opened 2 years ago

Closed 2 years ago

#31292 closed Bug (fixed)

Calling gdal_full_version() is broken on Python 3

Reported by: Diederik van der Boor Owned by: Diederik van der Boor
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Hasan Ramezani Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The GDAL _version_info() ctypes call uses a c_char_p type as first argument. In the Python-3 port (5330cd50cdb0674cd08cbfb40af9ac51267fbbec) the gdal_version() was updated to reflect that, but the gdal_full_version() function below was missed. It currently raises the following error:

ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

The solution is simply to call gdal's _version_info() with a bytes value too.
The PR https://github.com/django/django/pull/12467 fixes that.

Change History (8)

comment:1 Changed 2 years ago by Claude Paroz

Needs tests: set
Triage Stage: UnreviewedAccepted

comment:2 Changed 2 years ago by Hasan Ramezani

Cc: Hasan Ramezani added

comment:3 Changed 2 years ago by Taylor John Wood

Owner: changed from nobody to Taylor John Wood
Status: newassigned
Version: 3.0master

I will write tests for the patch this week.

comment:4 Changed 2 years ago by Hasan Ramezani

Needs tests: unset
Patch needs improvement: set

comment:5 Changed 2 years ago by Hasan Ramezani

Owner: changed from Taylor John Wood to Diederik van der Boor

comment:6 Changed 2 years ago by Diederik van der Boor

I've fixed the patch. I'll leave it to someone else to confirm this patch is OK now.

comment:7 Changed 2 years ago by Diederik van der Boor

Patch needs improvement: unset

comment:8 Changed 2 years ago by Mariusz Felisiak <felisiak.mariusz@…>

Resolution: fixed
Status: assignedclosed

In 84e35f46:

Fixed #31292 -- Fixed django.contrib.gis.gdal.gdal_full_version() crash.

Note: See TracTickets for help on using tickets.
Back to Top