Skip to content

Commit 3773248

Browse files
authored
Don't set data directory every time on context as no longer needed (#691)
1 parent dd7df93 commit 3773248

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

pyproj/_datadir.pyx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ cdef void pyproj_context_initialize(
173173

174174
cdef PJ_CONTEXT* pyproj_context_create(
175175
network=None,
176-
):
176+
) except *:
177177
"""
178178
Create and initialize the context(s) for pyproj.
179179
This also manages whether the global context is used.
@@ -182,16 +182,7 @@ cdef PJ_CONTEXT* pyproj_context_create(
182182
if _USE_GLOBAL_CONTEXT:
183183
return NULL
184184
cdef PJ_CONTEXT* context = proj_context_create()
185-
try:
186-
pyproj_context_initialize(
187-
context,
188-
network=network,
189-
)
190-
except DataDirError:
191-
if context != NULL:
192-
proj_context_destroy(context)
193-
context = NULL
194-
raise
185+
pyproj_context_set_enable_network(context, network=network)
195186
return context
196187

197188

0 commit comments

Comments
 (0)