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
importing from UNC roots doesn't work #47927
Comments
When executing a script from a UNC path, e.g. //myhost/exports/a.py, The workaround is to manually prepend a backslass to the UNC path in Note the related defect: http://bugs.python.org/issue954115 |
Correction: The workaround is to _append_ a backslash. |
Kristjan, you suggested this issue for consideration for 2.5.3. Is there an actual patch to apply? If not, the issue should get forwarded to 2.7 (and then to 2.8, and so |
No, not really. |
Ok, un-targetting this from 2.5.3 then. Usage of IsUNCRoot disappeared as part of r42230, which dropped usage of For the record: What *exactly* is the problem? I.e. specifically, what |
I think this is stat(2) problem on windows. Please try following test #include <stdio.h>
#include <sys/stat.h>
#include <windows.h>
void test(const char *path)
{
struct stat st;
printf("%s %d %d\n", path, stat(path, &st), GetFileAttributes(path));
}
int main()
{
test("e:\\shared");
test("e:\\shared\\"); /* issue1293 */
test("e:\\shared\\a.py");
test("\\\\whiterab-c2znlh\\shared"); /* this issue */
test("\\\\whiterab-c2znlh\\shared\\");
test("\\\\whiterab-c2znlh\\shared\\a.py");
} And this is result. e:\shared 0 16 As discussed in bpo-1293, stat(2) fails for the normal folder path with trunk/Python/import.c(3160) and trunk/Modules/zipimport.c(99) is using I'll create patch to prove my observation. :-) |
Ah, of cource, please change path to fit you environment. > test prog |
zipimport.c seems fine, because stat(2) succeeds for UNC file. It fails Already fix for bpo-1293 was in, so maybe I should create the patch for |
Just humble thought... |
Okay, I've tested the patch and made some beauty fixes. |
Checked in as revision: 68457 |
This fix needs to be ported to the py3k branch. Can somebody please do it? |
Merged in r68873(py3k). |
The path variable should be PyMem_Free'd (in both trunk and py3k) |
added the mem release in r68882. |
Added tests for UNC path imports in r68883 and r68884 |
Sorry if I'm missing something, but is this really needed? static PyObject *
imp_new_module(PyObject *self, PyObject *args)
{
char *name;
if (!PyArg_ParseTuple(args, "s:new_module", &name))
return NULL;
return PyModule_New(name);
} |
Yes, the "es" converter allocates memory. |
Ah, "es" is used in py3k, thanks. And sorry about my merge which had |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: