Issue #15835: Define PATH_MAX on HP-UX.
diff --git a/Include/osdefs.h b/Include/osdefs.h
index 90b430a..05c0c8e 100644
--- a/Include/osdefs.h
+++ b/Include/osdefs.h
@@ -29,6 +29,14 @@
 #endif
 
 /* Max pathname length */
+#ifdef __hpux
+#include <sys/param.h>
+#include <limits.h>
+#ifndef PATH_MAX
+#define PATH_MAX MAXPATHLEN
+#endif
+#endif
+
 #ifndef MAXPATHLEN
 #if defined(PATH_MAX) && PATH_MAX > 1024
 #define MAXPATHLEN PATH_MAX
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 501cb8c..976c04b 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -1,4 +1,5 @@
 #include "Python.h"
+#include "osdefs.h"
 #ifdef MS_WINDOWS
 #  include <windows.h>
 #endif